develooper Front page | perl.perl6.language | Postings from June 2001

Re: Per-object inheritance in core a red herring?

Thread Previous | Thread Next
From:
schwern
Date:
June 29, 2001 13:43
Subject:
Re: Per-object inheritance in core a red herring?
Message ID:
20010629164257.C19924@magnonel.guild.net
On Fri, Jun 29, 2001 at 08:59:59AM -0400, John Porter wrote:
> Michael G Schwern wrote:
> > Second, and perhaps more importantly, we can do this perfectly well
> > with a module.  No hacks, no tricks, no filters.
> > Class::Object uses the mini-class technique (ie. auto-generated
> > classes 
> 
> Sorry, that sounds like a hack/trick if ever there was one.
> I would sure hope there would be a cleaner way to do it in
> perl6, if it's not part of the core language.

"Any sufficiently encapsulated hack is no longer a hack."

Besides, that's EXACTLY what you're conceptually doing!  Each object
acts like its a member of its own class.  So you just implement it
that way.


> It's also not without its faults.  Having every instance of a
> class have different values of ref() could be obnoxious, for
> example.

Why?  You shouldn't be relying on an object's reference.  ref $obj eq
'Some::Class' wrecks subclassing, $obj->isa('Some::Class') is the
right way.


> > The rule of thumb has always been if you can do it in a module, don't
> > put it in the core.
> 
> No, that's a lousy rule of thumb.  The tradeoffs must be considered.
> Otherwise we'd have Forth.  (Or Lisp, ca. 1960.)

What's the trade-off here?  It works, its efficient, the hacks are
well encapsulated.


-- 
Michael G Schwern   <schwern@pobox.com>   http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <perl-qa@perl.org>       Kwalitee Is Job One

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About