|
On Fri, 12 Aug 2011 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