From: dblack@... Date: 2006-01-17T12:05:00+09:00 Subject: Re: basic question about Fixnum & Integer Hi -- On Tue, 17 Jan 2006, David Vallner wrote: > On Mon, 16 Jan 2006 22:27:37 +0100, Tom Allison wrote: > >> David Vallner wrote: >> >> [snip] >> >>> However, that is only a convention, and is not enforced. Some libraries, >>> like "mathn", don't define any new modules or classes, but instead (ab)use >>> the metaprogramming and reflective capacities of Ruby and modify existing >>> modules / classes by defining new methods or changing the behaviour of >>> existing ones. >> >> This should be discouraged or at least a consistent alternative. In any >> event, if it were possible to identify methods that require more than the >> stdlib or core.... >> > > Good luck finding support for that. Of course, noone dabbles into > this sort of voodoo without his metaprogramming helmet. Banging your > head against the wall in frustration at stuff not working can result > in severe head trauma. Ruby allows you to do this sort of magic, > and do it definately more easily and cleanly than in other languages > directly manipulating superclass lists and property dictionaries and > all such foolishness. This is a very distinctive feature of Ruby, > and no chance in hell it's getting nerfed or discouraged. It's > runninf with scissors, but sometimes you need to cut something > really quickly ;) mathn is in the standard library, so it's got a different relation to the rest of the distribution than a third-party library would. > That said, libraries that alter what is already present in other > namespaces are VERY rare. Not actively discouraged in the least, but > rare. It depends what you mean by actively. Dozens of people have certainly counseled against it, over the years. The difficulty, for me, has always been how to harness this particular kind of flexibility and openness, a prospect I've always found more intriguing than the prospect of just deciding that it exists for the purpose of being avoided. I think that if Ruby 2.0 has selector namespaces, we'll probably see some very creative and productive runtime class changing. Or maybe not. I've heard extremely little about anyone actually using any of the libraries that make block-scoped core changes possible. Maybe there isn't all that great a demand for orderly ways to do it. David -- David A. Black dblack@wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black