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   <[EMAIL PROTECTED]>   http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One

Reply via email to