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

Re: Questions, loose ends, misprints, etc.

At Thu, 01 Dec 2005 09:20:50 -0800, Per Bothner wrote:
> (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.

Good point. With `syntax-rules', this is often the case, though it
requires some analysis. With a more expressive macro system (e.g.,
`syntax-case'), the analysis quickly becomes difficult.

We're planning ahead for an expressive macro system. The idea begin
`indirect-export' is as follows: the compiler should be able to produce
good results for local definitions (even when expressive macros are
defined or imported) without an especially sophisticated analysis of
macro transformers.