Hi! On Thu 21 Apr 2011 17:56, Wolfgang J Moeller <w...@heenes.com> writes:
> btw., in R6RS and this latest "pre-R6RS" 'psyntax', the first argument > to datum->syntax must be an identifier, not an arbitrary syntax > form. Permitting the latter in the old 'psyntax' might have been a > mistake ... I've still got to read up some more, and think of a test. Hum, this might indeed be a bug. Thing is, the answer is not entirely clear. Check this commit log: commit 9846796b6abb6ecbce0d596db32daa7ac5921a2a Author: Andy Wingo <wi...@pobox.com> Date: Sun Jun 6 13:00:59 2010 +0200 fix module-hygiene corner case by relying more on syntax objects * module/ice-9/psyntax.scm (chi-macro): Instead of assuming that output of a macro should be scoped relative to the module that was current when the macro was defined, allow the module information associated with the syntax object itself to pass through unmolested. Fixes bug 29860. (datum->syntax): Propagate the module of the identifier through to the new syntax object, so that datum->syntax preserves module hygiene in addition to lexical hygiene. (include, include-from-path): Refactor to plumb though the hygiene information from the filename instead of the `include', allowing hygiene from the original caller of include-from-path to propagate through. * module/ice-9/psyntax-pp.scm: Regenerated. * test-suite/tests/syncase.test ("macro-generating macro"): Add test for bug 29860. There were two bugs fixed there, but I'm only interested in the latter, affecting `include-from-path'. The issue was that: (define-syntax include-from-path (syntax-rules () ((_ relname) (include (search-path relname))))) ... (include-from-path "foo") wasn't working, because the included forms were getting scoped relative to the `include' in the macro, not the `include-from-path' in the original invocation. That's because `include' used the #'include identifier for `datum->syntax' on the forms. This change fixed it to use the mark on "foo" instead -- a hack perhaps? Perhaps `include' should take a second argument, an identifier, to use in syntax->datum calls. Anyway, the hack did end up working though, and it would be prohibited by a change to datum->syntax. ISTR that Racket folk had a similar issue about a year ago too. Perhaps it makes more sense in their context, in which (foo) implicitly donotes an instance of the `%app' abstraction. Dunno! I guess I'm going to let this sleeping dog lie around for a while. When & if the time comes to fix it there will be some other code that needs patching too. Thanks for the note, Andy -- http://wingolog.org/