I’m trying to compare how packages and modules are declared and defined in programming languages.
The task is:
- if you have a package/crate/project called “pkg”, define a module/namespace “foo”, in a standalone file used only for that module, containing a function “bar”.
- use the module within the same package (so that
- use the module from a completely different package (so that
foo::bar()from “pkg” is callable).
How would you organize this? I’ve tried to come up with syntax used in various languages:
^ please view the table in the gist, since Discourse doesn’t support table markup
Please correct me if I got any languages wrong. Feel free to suggest syntax for other languages.