Matt Diephouse wrote:
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.

Let's do what the STL does and have hundreds of parent classes that have only limited functionality in order to permit people to force themselves to recreate it. Seriously, what's so bad about adding functionality into a language?

--
They who would give up an essential liberty for temporary security,
deserve neither liberty or security
--Benjamin Franklin

Reply via email to