lua-users home
lua-l archive

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

On 17/07/2018 22:37, Egor Skriptunoff wrote:

Last time I proposed "$" prefix because some programming languages (Perl,
bash, PHP) have variable names prefixed with "$".
But it seems some people dislike any similarities with Perl :-)
"$" was also criticized because it requires pressing SHIFT on a keyboard,
and programmers are usually lazy (laziness is the first great virtue of a
programmer, according to Larry Wall)
Ok, let's stop talking about Perl  :-)

This time I show another possible prefix: the backslash.
Backslash is not used in Lua syntax (except inside quoted strings), so why


-- Egor


Sorry if my answer doesn't cover all the details you covered.

I don't agree and that's why. To me it all boils down to two annoying aspects of what Lua would become with your proposal:

1. I really don't like optional syntax just to avoid "spelling mistakes". One of the benefit of Lua vs. Java and C++ is its small "human-memory footprint": I don't have to remember lots of details just to understand code *written by others*.

I might not use the "backslash notation" in my code, so I could forget about it, then I find some nice snippets of code from other people and then it takes much longer to decode or to integrate in my code base (and I'm no longer a professional developer, I imagine the nightmare of integrating two pieces of code with same "semantics" but different apparent syntax).

2. Worse still: I hate sigils on var names. It's a sort of dumbed-down namespace functionality and to my "parser mind" is extremely distracting (that's the same with MS hungarian notation, but I grew used to that in my occasional incursions in Windows API).

I would rather like a more full-fledged namespace functionality that didn't occur run-time penalties (like table access does), but I'm not sure how this would impact the size of Lua (and its overall usefulness could be debatable).

Moreover, anytime I see a non-alphnum symbol my mind tends to interpret it as an operator. It's not a matter of laziness in writing, but again, it is distracting when *reading* (especially debugging code) and it slows me down.

I am used to prefixes a la LaTeX, but then my mind is switched to "markup language" mode, and anyway, I don't like LaTeX syntax too much On the other hand I understand that in a substantially declarative language where code is mainly plain text interspersed with formatting/structuring commands keywords with sigils make sense, because they help you locate markup more easily in a sea of text (and they are lighter than HTML/XML tags). But I'm digressing.

Bottom line: your proposal would make my Lua experience more painful
I chose Lua as my main language years ago over Python as it was lightweight and its syntax was clean and easy to remember, even If I had to cope with it's lack of officially endorsed standard libraries; yes lots of high-quality one-man efforts, but these tend to be abandoned on the long run, especially if they are "hobby-projects".

I ended-up rolling my own (yep, substandard and not really complete, but good for my own use cases, and I can find a bug in them in a breeze), sometimes adapting code from others. This latter part is important: my efforts would have been much greater in understanding other people's code if the syntax had been more complex.

my 2 EURocent;


-- Lorenzo