lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, 15 Jun 2010 06:31:29 +0300, David Manura <> 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>


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.