lua-users home
lua-l archive

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


On Thu, Sep 28, 2006 at 07:27:30PM -0500, Rici Lake wrote:
> It could only optimize that by recognizing that i was a number; 

Right; Lua's generality makes a lot of optimizations difficult.

> If I understood your desire for "unary +" correctly, your needs would 
> be satisfied if the lexer recognized + as the first character in a 
> numeric lexeme, no? The use case did not seem to require the use of + 
> as an operator.

I do apply it to non-scalars.  Here's how I use it:

http://stepmania.cvs.sourceforge.net/stepmania/stepmania/Themes/default/metrics.ini?revision=1.1344&view=markup

Everything on the right side of X=Y is a Lua expression (except for
"Command" names, which are a shorthand that also generates Lua
expressions).  It's strange to not be able to do:

ExplanationX=+80
ExplanationY=-40

It's hacked around by removing initial +'s (and a couple other things).

(This is actually a scheme we've used for years, that only very recently
was generalized with Lua expressions at the core of all metrics.  I like
how it's worked out a lot.  The Command shorthand just converts "foo,1;bar,2"
to "self:foo(1); self:bar(2);", though special casing the suffix "Command"
is a hack.)

-- 
Glenn Maynard