From: Gavin Sinclair Date: 2004-12-09T09:05:22+09:00 Subject: Re: [ANN] Ruby/Extensions v0.6.0 On Thursday, December 9, 2004, 6:57:28 AM, Florian wrote: >> The methods added since 0.5 are summarised on the website: >> [...] > Thanks, I was fearing that there would be name clashes with the > Ruby-Junction library which defines Enumerable#none, #any, #all, > #with_count and #exactly. You might be interested to know that 'extensions' is careful about adding methods. If, for example, you did this: class Array; def rand; ...; end; end require 'extensions/array' then you'd get a warning on STDERR, something like WARNING: Array#rand exists, not overwriting But obviously method clashes are better discovered by human communication than by code. I'll have to check out the Ruby-Junction library. > Array#rand sounds interesting, but I wonder if it does not lead to > trouble when using rand() from a custom overloaded Array or Enumerable > method. What might an example of this trouble be? For a start, it's only defined on Array, not Enumerable. And its definition is very simple: def rand idx = Kernel.rand(self.size) at(idx) end So any array that properly implements size and at should do the trick. BTW Florian, while I've got you on this subject, I must apologise for an incorrect attribution in extensions: Florian Frank appears in there on one occasion instead of you. FINR :) Cheers, Gavin