[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A Review of MoonScript 0.2.0
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 15 Dec 2011 13:57:18 +0200
On Thu, Dec 15, 2011 at 1:45 PM, Alex Bradbury <asb@asbradbury.org> wrote:
> As the documentation states, this means `b = x-10` is converted to
> `local b = x(-10)`.
There's a few points like that, where a simple space can make all the
difference. It's hard to learn to watch out for single spaces ;)
> One aspect of Lua which Moonscript doesn't help with is the lack of a
> try/catch mechanism.
That would be consistent (it's a tricky thing to get exactly right, as
Fabien can tell you)
I suppose it would currently be:
ok,err = pcall ->
doSomething!
error "throw a wobbly"
doAnother!
if not ok
print "failed, dammit!", err
> local var = 100
> for i=1,10 do
> local var = i*i
> print(var)
> end
> print(var)
The closest MoonScript gets AFAIK to a solution is the 'using' clause
for functions:
http://moonscript.org/reference/#the_using_clause_controlling_destructive_assignment
It's a good example of a problem generated by local-as-default.
steve d.