lua-users home
lua-l archive

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


Jay Carlson <nop@nop.com> wrote:

> This README and source at http://place.org/~nop/lua/dollar/ . The talk
> about shell stuff from a while back had me panicking about compact
> syntax choices for quasi-quoted lists (never mind the jargon, that's
> what a shell language *is*). A slow panic I guess.

Interesting, thanks for posting. Reminds me a bit of
http://fanf.livejournal.com/105879.html though in that article I was
thinking about embedding other languages rather than quasiquotation.

I am in two minds about interpolation. It is very convenient, but it
leads to injection bugs in stringly-typed systems (where all data are
undifferentiated strings) where there isn't enough type checking to spot
when you failed to correctly escape a string before interpolating.

I wonder if Terrence Parr's "Strict Model-View Separation in Template
Engines" provides enough structure to make these bugs easier to handle.
http://www.stringtemplate.org/article/list
Along those lines I quite like the idea of compiling a $ string to a
function that takes the values to interpolate, e.g.
	$"$1: $2 lines"(total, count)

But then it's questionable if this is much better than a Python-style
overloading of the % operator to string.format...

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Trafalgar: Variable 3 in southeast Trafalgar, otherwise northerly or
northeasterly 5 to 7. Moderate or rough. Showers then mainly fair. Moderate or
good.