Hello June! On Sun 12 Jun 2011 03:24, BT Templeton <b...@hcoop.net> writes:
> What is `*current-language*' supposed to be used for? It is supposed to be a default language for the compiler and other things that are interested in languages. > I see that it's > set by `(@ (ice-9 eval-string) read-and-eval)' and by `(@ (system base > compile) read-and-compile)', but not by the REPL. That's a bug. Fixed, thanks for the report! > I think it might be preferable to require explicit language arguments to > all compilation functions, or to default to Scheme explicitly. We can change this in 2.2 I think if we want to. But do we want to? It seems like a classic use for dynamic scoping. > --- a/module/system/base/compile.scm > +++ b/module/system/base/compile.scm > @@ -120,9 +120,18 @@ > (and (false-if-exception (ensure-writable-dir (dirname f))) > f)))) > > +(define (guess-file-language file) > + (cond > + ((string-suffix? ".scm" file) > + (lookup-language 'scheme)) > + ((string-suffix? ".el" file) > + (lookup-language 'elisp)) > + (else > + (current-language)))) > + > (define* (compile-file file #:key > (output-file #f) > - (from (current-language)) > + (from (guess-file-language file)) I guess in general I'd prefer something like Racket's #!lang directives, though I'm not opposed to this approach. Dunno! Andy -- http://wingolog.org/