Re: Inheritance question.

[prev] [thread] [next] [Date index for 2004/06/15]

From: Tony Bowden
Subject: Re: Inheritance question.
Date: 06:38 on 15 Jun 2004
On Tue, Jun 15, 2004 at 06:55:36AM +0100, trlorenz@xxxxxxx.xxx wrote:
> The idea is that Music::CD and Music::CD::Cacheable both want to
> inherit the methods of Music::CD::BASE.

OK, so far.

> Being more robust than Music::CD::Cacheable, Music::CD wants to add
> to the inherited methods a few accessors of its own;

This is where you lose me. If they're both pointing at the same table,
why does this one have extra accessors?

> to do this, it's got to call columns(). The problem is, there's no
> public interface (that I know of) to *add* columns to the Essential group;
> you can only replace the entire group.

Why not add them to a completely different group that doesn't already
exist?

> Apparently, one could directly manipulate the "Essential" group via
> __grouper() in each class, but the double underscores are intimidating.
> My solution currently is to delete "artist" from the symbol table after
> the columns() call in Music::CD, but that's obviously pretty gross.

So calling a method with two underscores is worse than direct symbol
table hacking? :)

> Would it be a bad idea to have a class method add_columns() in addition
> to columns() to support this type of inheritance? Or is there a completely
> different way to set this sort of thing up? Or is this type of inheritance
> a Bad Thing for reasons I don't grasp?

I'm still not sure why you need it, but the next version of Class::DBI
will probably have a little less intimidating access to the Grouper. I'd
rather not just keep adding delegation methods to it if we can just make
it public itself for people who really need it. The private accessor to
it will keep working for a while (probably with a deprecated warning) so
you can safely use it for now without risking its sudden disappearance)

Tony

Inheritance question.
trlorenz 05:55 on 15 Jun 2004

Re: Inheritance question.
Tony Bowden 06:38 on 15 Jun 2004

Re: Inheritance question.
trlorenz 07:31 on 15 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52