lua-users home
lua-l archive

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


On Sat, Dec 21, 2013 at 3:54 AM, Hisham <h@hisham.hm> wrote:
> ...but that introduces a global change to your environment, anyway.

It's a valid tactic if you're fully in control of your application,
although redefining _existing_ functions is the kind of
monkey-patching that gave Ruby a bad name (because it changes the
semantics of any loaded libraries).

In Penlight, I let people choose whether they want to bring the
extended string functions pl.stringx into string itself, so people can
use them with a colon. Personally I only do this when writing scripts,
not programs.

(An idea that has been floating around: tying string/function/etc
metatable resolution to the environment, so one can write modules as
one pleases without messing with everyone else's modules.  But this
does not necessarily lead to nice clear self-evident code ;))