lua-users home
lua-l archive

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


Sorry for the top post.

I find a style guides ineffective for organizations larger than one developer.

More than any other language I have used, I find that each lua solution seems to have its own natural flow. The problem set almost defines the code style.

I've tried lots of styles over the last year or two and each time Lua manages to bust my pattern. Yes, obviously my patterns weren't great, but my point to Joe is this: you already did the right thing by reading code. Read lots and lots of people's code and you will soon learn what is effective in Lua. 

I am biased, but I find daurnimators code so elegantly simple it 'has no style'. 

Oh, and twenty indents? The version of Lua I use has a keyword called 'function'. And adhering to 80 columns is just silly. It was silly 20 years ago when I started writing code. 

Fwiw
Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
  Original Message  
From: Dirk Laurie
Sent: Tuesday, June 6, 2017 7:12 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: Lua Style Guide ?

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).