lua-users home
lua-l archive

Re: Short function definition syntax; thoughts on Lua

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


David Kastrup <dak@gnu.org> writes:
> The one thing that really struck me about Lua is that Lua programs looks
> like Lua. They don't go fancy-syntax fishing elsewhere. That's kind of
> unusual for a script language nowadays.
I agree, in general -- I like Lua syntax, and I don't like things like
attempts to sneak in C-bracey syntax extensions I've seen in the past.
But I think the || syntax for very short anonymous functions is fine.
Just because Lua is, in general, a very "keywordy" language, doesn't
mean it has to _completely_ eschew punctuation -- it uses "+" for
addition after all :) -- and I view || as being exactly in that same
vein, a short expression-oriented syntax, whose main goal is brevity.
[FWIW, I'd also like an ?: operator for in-expression if-else...]
-Miles
-- 
Monday, n. In Christian countries, the day after the baseball game.

AltStyle によって変換されたページ (->オリジナル) /