ProvableHQ/welcome

imports section

Closed this issue · 1 comments

Some suggestions on
https://developer.aleo.org/developer/language/imports

  • Starting right at the top, it would be good to describe what sorts of entities can be imported. It appears that any top-level definition from a file can be imported, as long as the file is in a reachable location, either under the src directory or under the imports directory (wherever that is) according to a certain directory pattern.

  • It would be good to be clear about what a "project" vs a "package" is throughout the docs, to be consistent in the nomenclature. It would be good to define here what a package is.

  • The first section, Local: Import from a local file in the same package src/ directory by its file name. This sentence is hard to parse and should be reworded to be clearer. Maybe: Import from a local file in the src/ directory of the current package.

  • Also in Local, I suggest making this initial example simpler by importing a single name, not multiple names. There is a later section for Import Multiple.

  • 2nd section, Foreign: Import from a foreign package in the imports/ directory using its [package] name. Is the imports/ directory defined anywhere? There should be a link to where it is defined. It is not clear in this section whether there is a config file somewhere that defines where it is, or whether it is supposed to be a sibling of the src directory (but that would not be very "foreign").

  • Combined 1st section and 2nd section. If we simplify the 1st section so it is only importing the circuit Bar, then that would be the exact same syntax as the 2nd section: import bar.Bar; What if both files src/bar.leo and imports/bar/src/lib.leo exist and both have a circuit Bar in them. Which Bar would be imported? What if Bar is only in one or only in the other, would Bar be found in both cases?

  • In the 2nd section, there is a little pattern describing what a Foreign import looks like: import [package].[name]; However, the other sections don't have little patterns describing what they look like. Also, can Foreign imports be renamed with the as keyword? This pattern implies that there are no other syntaxes for foreign imports.

  • 3rd section, Package Paths. The first example seems to conflict with the Foreign example. The Foreign example has a lib file name that is omitted from the import declaration's package path. But this example has no lib file. Is lib handled specially and omitted? If so, this fact should be mentioned.

  • The first three sections nicely show the imported definitions in one file and then the importing main.leo file. The last three sections, Import Aliases, Import Multiple, and Import Star could benefit from similar examples.

Hey @bendyarm this page no loner exists. Are any of these still relevant or is it okay to close?