----- Original Message ----

> From: Jon Lang <datawea...@gmail.com>

> > Actually, I'd prefer to go much further than this:
> >
> >  use Core 'MyCore';
> >
> > And have that override core classes lexically.
> >
> > That solves the "but I want it MY way" issue that many Perl and Ruby 
> programmers have, but they don't shoot anyone else in the foot.
> Since 'use' imports its elements into the current lexical scope, the
> version-based approach can do this.
> The only catch that I can think of has to do with derived classes:
> does the existence of a customized version of a class result in
> same-way-customized versions of the classes that are derived from the
> original class?  That is, if I added an "updated" version of Foo, and
> Bar has previously been defined as being derived from Foo, would I get
> a default "updated version" of Bar as well?  Or would I have to
> explicitly update each derived class to conform to the updated base
> class?

I'm not sure I understand you.  If 'Bar' inherits from 'Foo' and 'Foo' has 
extended the core Array class to lexically implement a .shuffle method, then I 
would expect 'Bar' to have that also.  There are two things involved:

1.  Liskov should be respected, when appropriate 
2.  'Bar' is coupled to 'Foo' and needs to know 'Foo's implementation (a 
charming anti-inheritance argument).  See #1 :)

Or did you mean something completely different?
Note that Liskov is great, but has issues at times when composition is unclear.

Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

Reply via email to