Re: MoonScript, a language that compiles to Lua
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: MoonScript, a language that compiles to Lua
- From: Pierre Chapuis <catwell@...>
- Date: 2011年8月12日 11:58:53 +0200
On 2011年8月12日 08:36:12 +0200, Axel Kittenberger wrote:
Except it forces indentation and structure in cases where it's not
entirely necessary. I like being able to write:
if x then doThings(x) else doThings(y) end
instead of:
if x then
doThings(x)
else
doThings(y)
Did you actually work with any significant whitespace language? E.g.
in python both work very well. You can always write all things in one
line if you want to.
What you just cannot do is:
if x then
doThings(x)
else
doThings(y)
To clarify in case you don't use Python: it doesn't only rely on
whitespace for conditionals, ie. you don't write this:
if x
doThings(x)
else
doThings(y)
but this:
if x:
doThings(x)
else:
doThings(y)
which you can write like this:
if x: doThings(x)
else: doThings(y)
I am not sure you can cleanly make this a one liner though.
An approach I like to solve the problem and make everybody
happy is the one used by the Go language: whitespace is not
significant but there is a canonical indentation style and
a tool (gofmt) that enforces it.
I don't see a reason why this wouldn't work with Lua. It is
probably possible to make a parser that takes valid Lua code
and returns a canonical representation for it.
--
Pierre 'catwell' Chapuis
- References:
- MoonScript, a language that compiles to Lua, leaf corcoran
- Re: MoonScript, a language that compiles to Lua, steve donovan
- Re: MoonScript, a language that compiles to Lua, Miles Bader
- Re: MoonScript, a language that compiles to Lua, Steve Litt
- Re: MoonScript, a language that compiles to Lua, Miles Bader
- Re: MoonScript, a language that compiles to Lua, oliver
- Re: MoonScript, a language that compiles to Lua, HyperHacker
- Re: MoonScript, a language that compiles to Lua, Axel Kittenberger