From: Geoffrey K. <ge...@kn...> - 2002-09-05 14:33:57
|
In DrScheme, when you select another "language," it seems to forget any acquired language features and revert to a base level of functionality before loading on the new functionality. On Thursday, September 5, 2002, at 09:45 AM, Ken Anderson wrote: > I'm not opposed to a module approach, but what happens in Common Lisp > is that macros become part of the compiler's environment. So when the > compiler compiles something it uses all the macros its seen. > > At 08:51 AM 9/5/2002, Timothy Hickey wrote: > >> On second thought, Graham's example points out the need for modules! >> In Dr. Scheme, one can specify a "language" when importing a module. >> The language is a collection of macros. >> >> I'll take a closer look at how the jscheme compiler handles macros >> and report back to this list. >> >> It would be nice to have someway of indicating in the program code >> that the program should be compiled using some set of macros. >> One easy way would be to add an "include" command that would simply >> include the macro code in the source before compiling, e.g. >> >> ;; macro2a.scm >> (include "macro1.scm") >> (define-macro (myplus2 a b) >> `(+ ,a ,b)) >> (.println java.lang.System.out$ (myplus1 1 2)) >> (.println java.lang.System.out$ (myplus2 1 2)) >> >> This is essentially the way the C handles shared type declarations, >> by storing them in .h files which are then included whereever they >> are needed. >> >> What do you think?? >> ---Tim--- >> >> >>>> At 07:24 PM 9/4/2002, Graham Spencer wrote: >>>>> Hello, >>>>> >>>>> I think I've found a bug in JScheme version 5.0.0. Given the >>>>> following two files: >>>>> >>>>> ;; macro1.scm >>>>> (define-macro (myplus1 a b) >>>>> `(+ ,a ,b)) >>>>> >>>>> ;; macro2.scm >>>>> (load "macro1.scm") >>>>> (define-macro (myplus2 a b) >>>>> `(+ ,a ,b)) >>>>> (.println java.lang.System.out$ (myplus1 1 2)) >>>>> (.println java.lang.System.out$ (myplus2 1 2)) >>>>> >>>>> If I compile both files to .class files and then run jscheme.REPL: >>>>> >>>>> Jscheme 5.0 04/05/2002 http://jscheme.sourceforge.net >>>>> > (load "macro2.scm") >>>>> 3 >>>>> 3 >>>>> #t >>>>> > (macro2.load) >>>>> (+ 1 2) >>>>> 3 >>>>> #null >>>>> >>>>> The (load "macro2.scm") works as expected, but in (macro2.load), >>>>> the macro defined in macro1.scm is expanded but not evaluated. In >>>>> general, I cannot get macros defined in one compiled .class file >>>>> to work in another file. Am I doing something wrong, or is this >>>>> really a bug? >>>>> >>>>> (My apologies if I should have posted this bug report somewhere >>>>> else.) >>>>> >>>>> Thanks for your help, >>>>> >>>>> --g >>>> >>>> >>>> >>>> ------------------------------------------------------- >>>> This sf.net email is sponsored by: OSDN - Tired of that same old >>>> cell phone? Get a new here for FREE! >>>> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 >>>> _______________________________________________ >>>> Jscheme-user mailing list >>>> Jsc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jscheme-user >>> >>> >>> >>> ------------------------------------------------------- >>> This sf.net email is sponsored by: OSDN - Tired of that same old >>> cell phone? Get a new here for FREE! >>> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 >>> _______________________________________________ >>> Jscheme-user mailing list >>> Jsc...@li... >>> https://lists.sourceforge.net/lists/listinfo/jscheme-user >> >> >> >> ------------------------------------------------------- >> This sf.net email is sponsored by: OSDN - Tired of that same old >> cell phone? Get a new here for FREE! >> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 >> _______________________________________________ >> Jscheme-user mailing list >> Jsc...@li... >> https://lists.sourceforge.net/lists/listinfo/jscheme-user >> > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Jscheme-user mailing list > Jsc...@li... > https://lists.sourceforge.net/lists/listinfo/jscheme-user > > -- Geoffrey S. Knauth http://knauth.org/gsk |