Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Recursive inheritance

by t0mas (Priest)
on Jun 13, 2000 at 15:58 UTC ( #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

Comment on Recursive inheritance
RE: Recursive inheritance
by Corion (Pope) 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 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.

    72656B636148206C72655020726568746F6E41207473754A

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;

    ---
    Crulx
    crulx@iaxs.net

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-09-21 02:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (166 votes), past polls