lua-users home
lua-l archive

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


> Finally, I am starting to like the practice of module
> namespacing by organization, i.e. "mycompany.util.stack".
> However when doing this I am unsure how to package those
> modules as rocks. Make a single "mycompany" rock?
> Make "mycompany-util"? Make "mycompany-util-stack"?
> 
> For close source, pure Lua modules I am shifting towards
> the second solution, but still allow users to just require
> a part of it (i.e. the Penlight model minus the global
> namespace pollution when requiring "pl"). For Open
> Source the third one appears to make more sense, but
> I am wondering if the trade-off in usability from the
> second one would not make sense as well ("mycompany"
> could be anything else, like "org.conman" here).
> 
> -- 
> Pierre Chapuis
> 

I’m also considering using this type of namespacing to prevent name conflicts. But it’s a bit messy when requiring a module, eg. `require “nl.thijsschreijer.binaryheap"

Additionally I’ve found myself using `.lua` extensions for Github projects, eg. `dns.lua` for some dns related utilities. This would be used as;
`luarocks install dns.lua`
`dns = require(‘dns’)`

Though the last one is used without the `.lua` extension I don’t think it will lead to much confusion.

Thijs