lua-users home
lua-l archive

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


On Mon, 2006-10-09 at 12:02 +0300, askok@dnainternet.net wrote:
> Opinions, am I getting completely nuts?
[snip]

Well, you already were nuts, but Aranha does have something similar to
this as you may recall from my presentation at the conference.

Aranha has:

>>some string with |value|s interpolated into it.<<

Where things in | markers are considered as expressions and parsed as
such in Lua's parser.

That above string gets parsed by Aranha as

__divertedstring("some string with %ss interpolated into it.", value)

But you get to have a lot more fun when you do things like

>>Hello |name|. You are |myage - yourage #d| years younger than I am.<<

which is *parsed* as:

__divertedstring("Hello %s. You are %d years younger than I am.", name,
myage - yourage)

Thusly allowing arbitrary expressions to be interpolated.

It wouldn't be a massive thing to do to extract this bit of Aranha's
functionality and alter it to be something slightly more generic for Lua
proper.

D.

-- 
Daniel Silverstone                         http://www.digital-scurf.org/
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895