lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On 2017-06-06 11:11 AM, Dirk Laurie wrote:
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).


I mean I guess one could argue for line-feed indentation...

--
local function x(a)

local function y(b)


return a+b

end

return y
end
--

Just remember to use a portrait monitor. Benefits include you can still use the full 80col per line, and you have more vertical space than horizontal space in portrait mode.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.