Dan- On Aug 31, 2007, at 5:30 PM, Dan Muresan wrote:
> Thanks for all the details! > >> p.s. (Only if you're interested) there is one feature missing from >> the above SRFI-55 implementation that I, as a user, would desire: >> expansion of a require-extension form should extend the compile-time >> syntactic environment with any syntax that is provided by the SRFI's >> that the form is requiring. > > You mean for SRFIs that export macros, like SRFI-42? > > Are you making a distinction between interpreted and compile-time? Almost. I am making a distinction between compiling code and running the compiled code. (Note that there's no interpreter usage here.) Native variants of Larceny will compile every expression that you load (or type at the REPL). But in such situations, the compile-time syntactic environment and run-time syntactic environment are the same, and the issues I was hinting at above do not arise. I do not have time to get into the details of this, so I'll just provide a quick rule of thumb: if you don't use the compile-file procedure, then you don't need to worry about this issue. That is, if you are just using Larceny to load up Scheme source code, then everything should work as you expect. If you *do* use the compile-file procedure, then you need to ensure that any special forms in the file you are compiling are either defined in that file you are compiling, or known to the compiler. Otherwise, the compiler will consider them to just be procedure invocations rather than special forms to be expanded. (The potentially tricky part of the above paragraph is that phrase "known to the compiler"; how does one tell Larceny's compiler about the special forms one wants the compiler to use? There are different methods, but the easiest one for you to adopt is to make sure that any such macro definitions are first loaded or defined before you compile the file at all.) I repeat again, if you do not use compile-file (or similar tools provided by Larceny), then I am pretty that this problem will not arise for you. (I am not saying that one shouldn't use compile-file; I am only saying that if one does, then one should be aware of the caveats.) -Felix p.s. Here's an example of where not having the appropriate syntactic environment when using compile-file can bite you. % cat testreqext.sch (require-extension (srfi 2)) % larceny Larceny v0.94 "Doomsday Device" (Aug 14 2007 10:56:17, precise:Linux:unified) larceny.heap, built on Wed Aug 1 12:53:28 EDT 2007 > (compile-file "testreqext.sch" "testreqext-firsttry.fasl") ;; (OOPS!) > (load "testreqext-firsttry.fasl") Error: Undefined global variable "srfi". Entering debugger; type "?" for help. debug> q > (load "defreqext.sch") ; this file has the define-syntax given earlier > (compile-file "testreqext.sch" "testreqext-secondtry.fasl") > (load "testreqext-secondtry.fasl") ;; this one succeeds! > _______________________________________________ Larceny-users mailing list [email protected] https://lists.ccs.neu.edu/bin/listinfo/larceny-users
