lua-users home
lua-l archive

Re: From: Norman Ramsey Re: Switch/Case statements revisited

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


 > |> * While I love Haskell/OCaml matching with pattern guards, I don't
 > |> see that as a good model for Lua, because Lua has no notion of
 > |> constant or constructor
 > 
 > It`s no true. `Nil`, `false` , `true`, 0.0, 1.0 ... {}, functions is a
 > constant.
Sorry, what I should have said to be precise is that the Lua grammar
does not include a syntactic category of constant. The major
syntactic categories in Lua are 'stat' and 'exp', and introducing a
new one would be a significant addition to the cognitive complexity of
the grammar.
In other words, right now you can explain Lua to newbies by saying
``look, a Lua program is just a sequence of statements, and while
there are many different ways to form statements, the only potentially
complicated part of a statement is an expression, and the same kinds
of expressions are used everywhere.''
 > Icon:
My Icon books are in storage and I better not try to reconstruct from
memory. There's a manual on the U of Arizona web site.
N

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