brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 109 forks source link

Design of 'provide statements' and visibility #1336

Closed InnPatron closed 6 years ago

InnPatron commented 6 years ago

While programming in Pyret, I have found that using provide statements was awkward. At the time, it was possibly undocumented and the syntax differed between provide and provide-types.

Furthermore a quick grep through the compiler source shows that almost all instances of provide statements use the wildcard.

This hints at a few things:

  1. A lot of items need to be made public
  2. The wildcard is preferred to manually making items public

My main goals of opening up this issue are:

  1. Agreeing on a more uniform provide statement syntax
  2. Confirming even the need for public/private visibility
  3. Deciding the default visibility

My take:

  1. Removing the braces around provide statements should be fine.
  2. I think module/file level visibility is important
  3. I think that PUBLIC should be the default visibility with a new 'hide' statement. I've noticed a lot of items are just provided with a wildcard. In addition, accessing an item from a different file requires prefixing it with the import file's alias, so name conflicts should not be that bad (unless I'm mistaken).
blerner commented 6 years ago

See #1015 and https://github.com/brownplt/pyret-lang/wiki/TM005---More-structured-module-system,-to-facilitate-data,-renaming,-bringing-identifiers-into-local-scope Public should not be the default, but it should definitely be easier to export just the things you actually want.

I'm going to close this issue as largely a duplicate of those other two links. Despite their age, this is indeed an important issue for us to address!