Email list hosting service & mailing list manager

Questions, loose ends, misprints, etc. Andre van Tonder (01 Dec 2005 15:00 UTC)
Re: Questions, loose ends, misprints, etc. Matthew Flatt (01 Dec 2005 16:00 UTC)
Re: Questions, loose ends, misprints, etc. Per Bothner (01 Dec 2005 17:21 UTC)
Re: Questions, loose ends, misprints, etc. Matthew Flatt (01 Dec 2005 17:27 UTC)
Re: Questions, loose ends, misprints, etc. Andre van Tonder (03 Dec 2005 16:20 UTC)
Re: Questions, loose ends, misprints, etc. Andre van Tonder (03 Dec 2005 22:41 UTC)
Re: Questions, loose ends, misprints, etc. Jens Axel Søgaard (01 Dec 2005 16:49 UTC)
Re: Questions, loose ends, misprints, etc. Matthew Flatt (01 Dec 2005 16:58 UTC)

Re: Questions, loose ends, misprints, etc. Per Bothner 01 Dec 2005 17:20 UTC

Andre van Tonder wrote:
>- Would it be possible to provide a rationale for the notion of
>  indirect exports

Matthew Flatt wrote:
> Indirect exports ensure that that all access and mutations to
> unexported bindings are apparent within the module (afer macro
> expansion). Consequently, the programmer and the compiler can
> potentially prove that certain bindings are always used in a certain
> way, such as "this unexported function is never called with the wrong
> number of arguments". This potential is particularly important for
> optimizing compilers.

I don't understand.  Doesn't lexical scoping do that?
If I do:

(library "foo-counter" "scheme://r6rs"
   (export get-foo incr-foo)
   (define foo 1)
   (define-syntax get-foo
     (syntax-rules ()
       ((get-foo)
        foo)))
   (define-syntax incr-foo
     (syntax-rules ()
       ((incr-foo)
        (set! foo (+ foo 1))))))

[Not sure about the exact syntax for 'exports' - srfi-83.html
is inaccessible right now.]

In the example, get-foo and incr-foo are exported, but foo itself is
not.  The compiler can prove that foo is never modified expect by
using incr-foo.  No indirect-exports declaration seems to be needed.

Or is indirect-exports meant for something different?

Kawa's module system allows get-foo and incr-foo to be exported
without foo, essentially as above.

--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/