Re: Recipe: setfenv with Lua 5.2.0 work3
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Recipe: setfenv with Lua 5.2.0 work3
- From: "Juris Kalnins" <juris@...>
- Date: 2010年6月15日 08:15:52 +0300
On 2010年6月15日 06:31:29 +0300, David Manura <dm.lua@math2.org> wrote:
> In these discussions in the list, sometimes it looks like people are
> changing environments all the time, in all sorts of code.
[..]
A tangential point on DSLs: environments or not, it often feels to me
that fitting DSL's into unmodified Lua syntax in clunky. I think it's
because that unlike XML or s-expressions, Lua has a particular
evaluation order (not pure data), can only be combined in certain ways
(e.g. expressions v.s. statements), and omits order and multiplicity
of key-value pair lists (tables), so the DSL must be fit into this
"Lua" model.
Actually, XML trees map to Lua table constructors very nicely:
<n1 a1="1" a2="3"><n2/><n2 a3="3">lala</n2></n1>
becomes
n1 { a1=1, a2=3, n2 {}, n2 { a3=3, "lala" } }
Provided that attribute names are not integer numbers. This is
currently my main use of environment changing.