lua-users home
lua-l archive

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


On Fri, 2007-01-12 at 10:32 -0500, Rici Lake wrote:
> On 12-Jan-07, at 10:23 AM, James Hearn wrote:
> 
> >> Can you give any examples of other programming languages that does
> >> something similar? inject functions into other namespaces?
> >
> > In Ruby all classes and modules are "open" meaning that other classes
> > are free to inject, patch, or otherwise modify their class
> > definitions. As a particular example Ruby on Rails adds functionality
> > to core classes like strings and numbers (!) It's definitely a
> > different approach than the standard in most other languages, but the
> > Ruby camp considers it a strength rather than a drawback.
> 
> This is also considered a strength of Smalltalk / Squeak and 
> Objective-C, as I understand it.

Even if I agree it can good to be able to do it, I fail to see why is it
"best practices" to actually do it.

I fully agree with the following comment on
http://lua-users.org/wiki/ExtensionProposal

"Mark, thanks for this implementation. I'll add to the chorus here of
keeping functions only under the ex module and by default not
"polluting" (to use the term from Perl) the os and io modules. If the
user chooses to pollute the standard io and os modules, they may do so
by explicitly calling an ex.install() or similar function as suggested
above. That gives users a choice. I'd recommend this practice at least
until the Lua standardization people give a stamp of approval."