lua-users home
lua-l archive

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

On Mon, Apr 15, 2013 at 10:34 AM, Pierre Chapuis <> wrote:
These issues are not imaginary, they are real, they happen when you make
large scale programs. I am not even talking about modules that abuse the
fact that some modules expose globals to monkey-patch them and do it

Ouch!  That is most definitely a fail.  To burden a person working on their own complex problem with that kind of module issue is not fair.

The first law of monkey-patching is "Don't". The second is .. "Not yet...".

I'd say that module developers work under special constraints, in order to allow their users to relax and do whatever monkey-patching _they_ desire to do!   A library writer does extra work, so that the users don't have to.

This indeed has nothing to do with 'local pairs,ipairs = pairs,ipairs'. We all know these guys are hanging around, wanting to be used. But this can indeed speed things up. However, optimization should never be a spinal reflex, and can never be reduced to dogma. Here I suspect that a local alias of pairs would hardly make any difference, whereas a local alias of tostring could be worth it. (Although I appreciate that this style allows dependencies to presented explicitly up-front, which is a good thing for your readers. It would be straightforward to integrate a static globals analysis tool with an IDE to make this boilerplate generation a keystroke away)