Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Recursive inheritance

by t0mas (Priest)
on Jun 13, 2000 at 15:58 UTC ( [id://17874]=poem: print w/replies, xml ) Need Help??

package Life; @ISA=qw(Girl);
package Girl; @ISA=qw(Life);

So please help me, give me some assistance,
I need to use them both,
without ending up in a recursive inheritance.

/brother t0mas

Replies are listed 'Best First'.
RE: Recursive inheritance
by Corion (Patriarch) on Jun 13, 2000 at 16:12 UTC

    Uhoh !

    Except for abstracting the interfaces and splitting up both Life and Girl, I don't see much chance for you.

    My proposition assumes that Girl needs certain aspects of Life, which in turn needs certain (other) aspects of Girl. So you should create a third package, Base, which has all the functions Girl needs to work, and then you can have package Life; @ISA=qw(Girl); (or the other way around.

    Yes, this will be complicated and require rethinking of the interfaces and object structure. No, there is no other way (at least I don't see it). Sorry ;)

RE: Recursive inheritance
by Crulx (Monk) on Jun 15, 2000 at 07:56 UTC
    Even more perlish/catch-22ish..
    package Life; require Girl; package Girl; require Life;

RE: Recursive inheritance
by reptile (Monk) on Jun 14, 2000 at 02:44 UTC

    Call me strange but I think that's beautiful :p I know exactly what that is like. I'll probably get voted down for posting this dumb 'me too' post but I don't care I just had to say it.

    Thanks for posting that, t0mas. It was really clever and I always appreciate a programming analogy to the facts of life.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://17874]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-17 21:51 GMT
Find Nodes?
    Voting Booth?

    No recent polls found