lua-users home
lua-l archive

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


On 11/21/2017 12:56 AM, Sean Conner wrote:
> It was thus said that the Great Daurnimator once stated:
>>
>> Additionally, your code is only 5 lines of code that sets a global
>> object's metatable....
>> https://bitbucket.org/TeamSoni/cratable/src/73f6028ef90ee67ced148d894fd93a5333e9a8bd/cratable.lua?at=master&fileviewer=file-view-default#cratable.lua-24
>> I'm not sure why this is something that deserves to be its own module.
> 
>   I also have several other ones that consist of a single function (but are
> longer than a few lines.  I'm still debating how I feel about this---on the
> one hand, writing such hperfocused modules allows one to just include what
> is needed and prevent a much larger attack surface for exploits.  It also
> prevents a module with a mishmash of functionality from being created.
> 
>   On the other hand, it does seem strange to have a module of a few lines.
> 
>   -spc

I came to similar approach a couple years ago. One-screen files. Very easy to
implement and extend. Easy to understand and test any atomic part. (Errors of
misnaming some variable 1200 lines above are gone.) Harder to understand whole
structure. Hard to create uniform directory structure to host them.

Unlike 'npm' way I deploy code with all used modules. So there is zero external
dependencies and no need to keep backward compatibility.

-- Martin