lua-users home
lua-l archive

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


On Sun, 28 Oct 2018 at 07:38, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
> The article now seems to be freely available at
> https://cacm.acm.org/magazines/2018/11/232214-a-look-at-the-design-of-lua/fulltext

I'm slightly annoyed that basic Lua module examples often display
messy naming practices. Here, the module is written named as "M",
stored in a file called "mymodule" and required into a variable "vec".
I understand that this is to didactically showcase that the names are
not _required_ to be the same, but it promotes those practices (which
are sadly common among Lua programmers, probably due to top-down
examples like this) and IMO it makes the module system look even more
jerry-rigged. The article itself mentions that the module system is
not as elegant as it could be. The naming choices here don't do it any
favors: if everything was named "vec" in that example, programmers
coming from other languages would find it pretty straightforward. And
if the non-messy approach was common practice, I wouldn't have to
explain to coworkers why Lua module names don't match when they are
finding their way through large codebases.

Let people learn that names don't need to match when the day arrives
when they need to resolve an actual naming conflict, instead of
promoting messy naming from day one.

-- Hisham