lua-users home
lua-l archive

Re: A Look at the Design of Lua

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


It was thus said that the Great Dirk Laurie once stated:
> Op Wo., 31 Okt. 2018 om 16:38 het Hisham <h@hisham.hm> geskryf:
> 
> > 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.
> 
> I have no problem with what Lua programmers do. In fact local renaming
> is to my mind good practice.
 The package name is "lua-xml". The file is "LuaXml.lua". The resulting
module name is "xml". Annoying as hell.
> local json = require"org.conman.parsers.json"
> 
> Nothing wrong with that.
 No. But there, the package name is 'org.connman.parsers.json'. The file
is 'org/conman/parsers/json.lua'. And the resulting module is named ...
well, in this case, it would be a local variable named 'json'. There's a
logical progression one can follow.
> I do have a problem with what some Lua package writers do. The actual
> name to be required is something Unixly cryptic like lfs or lom. but
> the package name is longer (luafilesystem) and may even have nothing
> to do with the module name (luaexpat). BTW why must the package name
> start with or contain the tautological "lua"?
 Because otherwise someone might mistake it for JavaScript.
 -spc

AltStyle によって変換されたページ (->オリジナル) /