[bitc-dev] DISCUSS: Re-work of module system and multiple aliases

Jonathan S. Shapiro shap at eros-os.com
Sun Jul 20 13:09:05 CDT 2008


There is an open issue concerning local aliases. We may want to consider
restricting imports in such a way that exactly one local alias can be
constructed for each imported symbol.

At the moment, the following is legal in the new IMPORT specification:

  (import Foo (bar as baz) bar)
  (provide FOO bar)

  ;; baz is an ALIAS. The following supplies a definition for Foo::bar:
  (define (baz x) ...)

  ;; Error: bar is an ALIAS for Foo::bar, which is already defined.
  (define (bar x) ...)

It would be fairly straightforward to restrict imports such that an
imported name can only be bound to a single local alias name. This might
actually be useful, because it would let us say:

  (import Foo (collidingName as localSubstitute))
  (import Foo) ;; imports all unimported symbols, which would exclude
                  collidingName, because that is already imported and
                  bound

I'm actually inclined to favor this. What do other people think?


shap



More information about the bitc-dev mailing list