[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua Style Guide ?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 6 Jun 2017 16:11:52 +0200
2017-06-06 15:25 GMT+02:00 Marc Balmer <marc@msys.ch>:
> Tabs are holy. Spaces, no matter how many, are just a cheap substitute.
>
> Any yes, any line shall never exceed 80 characters, that's the eleventh
> commandment!
WIth great respect to all those who are gleefully enjoying the direction
this thread is going, a quotation from the Bible [1]:
Whitespace of whitespaces, saith the Programmer; all is whitespace.
After all, Lua is whitespace-agnostic; you can just pass your chunk
of code to quite a simple reformatter [2].
Style is much more than that.
It deals with questions such as:
- Do you explicitly code 'nil' in situations where it will be supplied
by default?
- Do you write "y=10*x" or "y=10.0*x" when you know that x is
floating-point?
- Do you monkeypatch globals?
- Do you use closures to encapsulate upvalues?
[1] Modern Geek Version.
[2] Any idiot can write one.[3] My first Lua program (part of my LuaTeX
primer) was just such a reformatter.
[3] Not necessarily a good one. My first Lua program can't reformat
itself (failure to take into account the "--[^\n]*\n" comment construction).