There are a few I’m aware of:

  1. Rust-style use (multiple imports per statement, renaming items using as)
  2. Java-style import (single import per statement, no renaming (afaik))
  3. Zig-style let xlib = @import("xlib") (imports as assignments)
  4. C-style #include (no importing, just pastes the code of the named file)
  • Traister101@lemmy.today
    link
    fedilink
    arrow-up
    0
    ·
    10 days ago

    Java doesnt have aliases. You can do glob imports of a particular package (IE all the classes) and you can statically glob import all the static functions in a class but uh yeah that’s it

      • terabyterex@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        10 days ago

        you can also tell them java cant handle.pointers. i have worked with a lot of backend c code using c#.

        not sure about the following but:

        can you control how a struct is handled in memory in java? (had tto do this with a c# front end calling a credit card verifyling service/library written in c++)

        do they have value types?

        • programmerlexi@sh.itjust.worksOP
          link
          fedilink
          arrow-up
          0
          ·
          10 days ago

          You cqn’t really control the layout as that would prevent the JVM from reshaping your classes (which is a fundamental requirement for things like Dalvik (android jvm))