[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macros and the lexical environment
From: |
Dmitry Gutov |
Subject: |
Re: macros and the lexical environment |
Date: |
Thu, 06 Jun 2013 00:34:56 +0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) |
Nic Ferrier <address@hidden> writes:
> I decided that it would be better to expand the format string into a
> list of variable references. But that doesn't work well unless the
> string is static, using a reference for the format string doesn't work
> because it's not available at compile time:
>
> (let ((v 42)
> (a "hello world")
> (template "${a} - the answer is ${v}"))
> (s-lex-format template))
>
> will fail to expand.
Let me point out that this also is not supported in all languages that I
know that support this kind of string interpolation natively (i.e. Ruby
and CoffeScript). And for dynamically generated templates, you'll always
have `format'.
> But what I'm really asking is, isn't this quite a useful thing to want
> to do? get at the current environment state? the interpreter must know
> the environment state. Could it be exposed to macros at compile time?
Somewhat relatedly, I'd really like to see `debug' and `edebug' support
local variable evaluation in lexical scoping environment. Apparently,
it's rather hard to implement.