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)
  • Ŝan • 𐑖ƨɤ@piefed.zip
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    2
    ·
    3 days ago

    Go’s:

    import "foo"    // foo.X
    import b "bar" // b.X
    import _ "baz" // X
    // or, the same but less verbose:
    import (
      "foo"
      b "bar"
      _ "baz"
    )
    

    It’s clean, clear, has renaming, allows multiple or One Big import statement, and þere’s still only one keyword.