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)
you are viewing a single comment's thread
view the rest of the comments
[–] 8 points 21 hours ago (1 child)

In order or preference, out of the ones I'm familiar with:

  1. Java. Very simple. Diff friendly. Import names match the filesystem.
  2. Rust. Also good - you can do it diff friendly though nobody does. Slightly confusing distinction between module hierarchy and filesystem.
  3. Python. Pretty bad. Conflates third party packages with local files, almost nobody actually understands relative imports, even more confusing distinction between module hierarchy and filesystem. Module imports can have side effects. Unnecessarily different syntax between import... and from .... import....
  4. C/C++. Obviously this is the worst.
  • source
  • hideshow 1 child comment