Joshua Juran <[EMAIL PROTECTED]> wrote:
On Aug 28, 2006, at 12:18 PM, Matt Diephouse wrote:
> I would like to add some sort methods as well: quicksort(),
> mergesort(), etc. But as methods, there is potential for these to end
> up in a user-visible space.
>
> Say for example, that I add a mergesort method to AbstractPMCArray.
> Ruby's array class wouldn't be able to use AbstractPMCArray as a base
> class because there is no mergesort method on an Array in Ruby.
>
> Any thoughts?
How about requiring array classes to implement swap(), and then
implementing sort algorithms in terms of that, as in C++?
Adding swap() would remove a level or two of indireciton, but this
ignores the underlying problem of methods on PMCs leaking into
user-visible spaces.
--
Matt Diephouse
http://matt.diephouse.com