[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua and Saint-Exupery?
- From: Jamie Webb <j@...>
- Date: Sat, 26 Feb 2005 02:03:30 +0000
On Fri, Feb 25, 2005 at 10:56:09PM +0000, David Given wrote:
> On Friday 25 February 2005 21:23, Mark Hamburg wrote:
> [...]
> > By what syntactic rule would you recognize that this was the correct
> > parsing? You have no type information available about any of the keywords
> > above. How would you distinguish between a parsing of:
>
> You don't. Functions are always left-associative.
You mean right-associative.
So, supposing you write:
function foo()
sparkly(large)
green(object)
end
Bearing in mind that (apart from one little hitch) Lua doesn't
consider newlines significant, your Lua would interpret that the way
the current Lua interprets:
function foo()
sparkly(large(green(object)))
end
How would you get the expected behaviour of the first case? Introduce
semicolons? Make newlines end a statement? Now we're talking about
making a completely new language...
OTOH, I see no reason why one couldn't write:
sparkly function() ... end
or:
sparkly true
or:
x = {
foo()
bar()
baz()
}
Especially the last of those (I think sol has this?) would be quite
useful for data description. Maybe these are absent because of the
arbitrary-line-noise-is-valid-perl argument? If so, I don't think I
agree. Strong testing and all... (not that I actually agree with that
article)
Anyway, good syntaxes are surprising hard to design, and there are
always compromises. Requirement of brackets in some cases is one of
Lua's.
-- Jamie Webb