From: Andy Wingo <wingo@pobox.com>
To: BT Templeton <bpt@hcoop.net>
Cc: guile-devel@gnu.org
Subject: Re: *current-language*
Date: Sun, 04 Dec 2011 22:01:44 +0100 [thread overview]
Message-ID: <87vcpw9hl3.fsf@pobox.com> (raw)
In-Reply-To: <87pqmjj0zo.fsf@olor.terpri.org> (BT Templeton's message of "Sat, 11 Jun 2011 21:24:11 -0400")
Hello June!
On Sun 12 Jun 2011 03:24, BT Templeton <bpt@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/
next prev parent reply other threads:[~2011-12-04 21:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-12 1:24 *current-language* BT Templeton
2011-07-09 1:03 ` *current-language* BT Templeton
2011-12-04 21:01 ` Andy Wingo [this message]
2011-12-06 0:36 ` *current-language* Noah Lavine
2012-01-07 0:19 ` *current-language* Andy Wingo
[not found] <201201070033.q070X8vT001386@winooski.ccs.neu.edu>
2012-01-07 1:56 ` *current-language* Eli Barzilay
2012-01-07 2:09 ` *current-language* Andy Wingo
2012-01-07 2:30 ` *current-language* Eli Barzilay
2012-01-07 22:41 ` *current-language* Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vcpw9hl3.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=bpt@hcoop.net \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).