[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: module questions




Cc'd to the list as it's of general interest IMO.

> From: Eli Barzilay <eli@barzilay.org>
> Date: Sun, 30 Dec 2001 18:23:55 -0500
> 
> On Dec 29, Michael Vanier wrote:
> > I hadn't thought of this; thanks for bringing it up.  It's like
> > `define-public' in guile.  OTOH I don't see why, given that you are
> > allowed to export all the bindings from an imported module with a
> > single line in the provide statement, you can't also export all the
> > bindings in the current module, or (better) all but some selected
> > internal functions, which is normally what I'd want to do.  It
> > sounds like an oversight to me.
> 
> Well, technically, you can't export all bindings from an imported
> module, only the bindings that it exported in the first place...  So
> there should always be some `provide' point for every exported binding
> somewhere...  But, if you think that it doesn't make sense then you
> can suggest it to Matthew and maybe you'll convince him...
> 

OK, let me be very explicit about what I want.  I'm not talking about
controlling the export of imported bindings.  The module system handles
those just fine.  What I want is more fine-grained control over the
bindings I export from the current module i.e. the module being defined.
As I understand it, as of now I have to put every binding that I want to
export into a provide statement e.g.

(module foo mzscheme
  (provide
     func1
     func2
	 func3
	 ...
     func100)

  (define (func1 x y z) ...)
  (define (func2 x y) ...)

  ...

)


What I want to do would look something like this:

(module foo mzscheme
  (provide all)

  (define (func1 x y z) ...)
  (define (func2 x y) ...)

  ...

)

or (more often):

(module foo mzscheme
  (provide all-but func1 func10 func99)

  (define (func1 x y z) ...)
  (define (func2 x y) ...)

  ...

)

This seems fully in keeping with the current syntax.  Sure, I could define
a macro that wraps "define", but that's an ugly solution.  What's wrong
with the syntax I've sketched out above?  Would this really require that
big a change to the system?  I'm not saying it's high priority, but it
would be nice.

On a completely unrelated note, I've been going through the unit
documentation, and this question occurred to me: how do you invoke a unit
that is located in a different file?

Mike