From: Aubrey Jaffer <[email protected]> Subject: Re: [r6rs-discuss] identifiers vs. symbols Date: Sat, 12 Sep 2009 21:18:34 -0400 (EDT)
> | Date: Fri, 11 Sep 2009 22:55:00 -0400 > | From: Lynn Winebarger <[email protected]> > | > | On Fri, Sep 11, 2009 at 10:46 PM, Aubrey Jaffer<[email protected]> wrote: > | > ,A | Date: Wed, 9 Sep 2009 00:30:18 -0400 > | > ,A | From: Lynn Winebarger <[email protected]> > | > ,A | > | > ,A | ... > | > ,A | The advent of hygeinic macros marked the end of the era in which > | > ,A | symbols could be equated with identifiers. ,A Identifiers have a > lot > | > ,A | more information in them. > | > > | > The SLIB implementations of syntactic-closures, syntax-case, > | > syntax-rules, and macros-that-work all generate vanilla R4RS code > | > (with no macros) from the source code having hygienic (and > | > non-hygienic) macros. > | > > | > This would seem to contradict your claim that identifiers can't be > | > equated with symbols. > | > > | > The Scheme compilers I have written macro-expand all input source in > | > order to deal with simplified expressions containing symbols, not > | > identifiers. > | > > | And are the symbols used in the expansion process and the output code > | that corresponding to identifiers in the input code eq? to the original > | identifier? > > Expanding the hygienic macro for CASE, both macros-that-work and > syntactic-closures rename only lambda-bound variables. I'm afraid that it only works without modules. With r6rs syntax (sorry if there're mistakes; I'm not fluent in r6rs yet): ================ (library (foo) (export my-when) (import (rnrs 6)) (define-syntax my-when (syntax-rules () ((my-when test expr ...) (if test (begin expr ...)))))) (import (except (rnrs 6) if begin)) (import (for (foo) expand)) (define if list) (define begin list) (my-when #t 'a 'b) =============== I suppose 'if' and 'begin' in the expanded form of my-when shouldn't refer to the redefined 'if' and 'begin', but should refer to the original (r6rs's) 'if' and 'begin'. You could do that by extensive renaming of global names. (e.g. (1) make all global names r6rs have alias like r6rs:if, r6rs:begin etc, (2) my-when expander inserts those aliased names in the expanded form, and (3) (import (except (rnrs 6) if begin)) makes all r6rs aliased names, plus all r6rs original names except 'if' and 'begin'.) But to do so, at least the macro expander must be aware of the identity of global names (i.e. my-when expander should recognize that the inserted 'if' and 'begin' are from r6rs). I tend to think the notion of "identifier" is just an abstraction of "a symbol that is aware of where it came from". --shiro _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
