From: Charles Comstock Date: 2004-03-08T04:29:40+09:00 Subject: Re: random range > > It's not redefining rand to take more varied arguments that's a bad > thing, it's defining it for Array#rand that's a Bad Idea(tm), IMHO. > Kernel is included in Object so that you can access it's methods easily > within other objects. Redefining it in a subclass could potentially > break lots of code. For example, I often do this: > > class Array > def randomize() > sort{rand(2)-0.5} > end > end > > .. and defining an Array#rand would break this. > > I like the idea of allowing Kernel.rand(range), for reasons already > presented by others. Kernel.rand(array) seems a little iffy to me, but > that's me. :) > > --Mark > That's kind of interesting, I have always thought that half the reason wy object oriented programming is popular is that it allows you to have to different methods of scoping. One way is the standard lexical function style, and the other is dynamic scoping. It's just cleverely disguised. Charles Comstock