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

[Scheme-reports] Fwd: Re: file inclusion (section 4.1.7 of draft 9)

Reposting with the correct "from" address...
Essentially the same idea that was expressed by Takashi Kato.

On 07/06/13 11:38 PM, John Cowan wrote:
> Daniel Villeneuve scripsit:
>> (define-syntax m
>>     (syntax-rules ()
>>       ((_) (lambda (a) (include "some/file.sch")))))
>> where the file "some/file.sch" contains, say,
>> (+ a 1)
>> Is the symbol `a' in "some/file.sch" supposed to match the
>> lambda's argument?
> Yes, I believe so: files are included at the S-expression level,
> not hygienically.
Well, in an explicit-renaming macro system, my understanding is that I would get the following expansions (with [] on the right denoting the environment produced by the explicit-renaming system as macro expansion is performed):

(m) []
(lambda.0 (a.0) (include.0 "some/file.sch")) [lambda.0 => lambda, a.0 => free, include.0 => include]
(begin (+ a 1)) [lambda.0 => lambda, a.0 => arg0, include.0 => include]

and at this point, a plain `a' is not found in the environment as arg0.

If the above is correct, I would say that non-hygienic file inclusion makes the `a' in the included file not match the `a' bound in the macro (possibly generating an error, or a reference to another binding of `a').

Is this really the intent?
Daniel Villeneuve

Scheme-reports mailing list