[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Indentation (Was: Re: MoonScript ...
- From: Dirk Laurie <dpl@...>
- Date: Fri, 12 Aug 2011 12:21:15 +0200
On Fri, Aug 12, 2011 at 11:58:53AM +0200, Pierre Chapuis wrote:
>
> if x: doThings(x)
> else: doThings(y)
>
> I am not sure you can cleanly make this a one liner though.
Python 2.5 and later (don't have the older serpents around):
doThings(x) if x else doThings(y)
> 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.
>
The style used in PiL is a candidate.
> 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.
>
For example: if you make an entry in LuaWiki that contains in
its source
{{{!Lua
...
}}}
it would not merely highlight keywords as it does now, but also
do the indents. It would show up canonically, no matter how it
was typed in. Why not?
Dirk
- 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
- Re: MoonScript, a language that compiles to Lua, Pierre Chapuis