lua-users home
lua-l archive

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



On 18 Jun 2012, at 12:44, Patrick Masotta wrote:

1) I have read the archives and the reasons they give are too naive, When 0 was created human being had a hard time understanding the meaning of 0 but 0 prevailed for some reason… The same when programming there are many reasons why Programmers (even occasional ones) have to learn to use 0 based arrays..
 
2) for you the wordy sequences make the code easier to understand? How long was the longest program you ever made?
As I said before, the bracket reasons go far beyond the compiler needs…
 
3) small and clean does not have to mean “incomplete”… Switch and Continue should be there…
The funny thing is that LUA is made by “C”  coders… really hard to understand…
 
Pat

1) Well there's your answer. The original Lua authors decided that 1 indexing was more human friendly. There's no point in discussing this further, the Lua maintainers will not change this behaviour, it would cause huge compatibility issues.

2) Yes. It reads as sentence (if done correctly). It's called semantic programming. Code styled this way is generally easier to understand because it's self describing.

if user.logged_in then
   logout(user)
end

I just wish they'd allowed trailing punctuation in function names like ruby…

if user.logged_in? then
   logout!(user)
end

Regarding LoC-Peen, This dicussion is largely pointless, if understandability of your code decreases as your body of code increases (past a point) then you have fundamental style and architecture issues that no amount of syntactic futzing will fix. Whether you're using curly braces or statements is largely irrelevant.

If you really find C that much more readable, it's probably because you've been writing vast quantities of it, and are very used to a certain look and formatting style.

3) As I said they're redundant. After being forced to use Perl for a large OOPy project, I can say with some certainty that redundancy does not add to the clarity of code or the usability of a language.

-Arran