[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: From: Norman Ramsey Re: Switch/Case statements revisited
- From: Norman Ramsey <nr@...>
- Date: Sat, 10 Nov 2007 20:29:26 -0500
> |> * 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