perlmeditation
Ctrl-z
<p>forgive me monks, for i have sinned. This is my first confession</p>
<p><em>And what have you done my son?</em></p>
<p>I have impure thoughts on altering @ISA during runtime. Often.</p>
<p><strong>Disclaimer: I am a newbie, to Perl and OOP - and largely dont understand
the underlying concepts of how Perl works. I apologise if I cant provide a more
informed case. This is what Im looking to get from posting this meditation.</strong></p>
<p>So, as I understand it the @ISA is a bit of a hack onto Perl and possibly a conceptual faux pas in regard to "purer" OO languages. Using base.pm
seems to be preferred to having the programmer directly manipulate @ISA, though
of course, thats pretty much what base.pm does. I wonder that maybe this transparency
is not a good thing, and that having a regular array of inheritence is a boon
as oppose to a cheap trick.</p>
<p>Consider the obligitary Employee class. An Employee isa Person isa Mammal isa...</p>
<p>Of course, an Employee may also be a Musician, Artist, Trainspotter (in their
spare time), or a Father, Husband, Buddy, or a Jerk, Hero, Nondescript-Bystander.
There is no little tree diagram that can display this, because largely it is
a matter of perspective. Once you have the perspective of the "viewer"
(perhaps the user, or another object) then the tree of inheritence <em>can</em>
organise itself. Its not the One True Tree of the Employee class - its just
a perspective.</p>
<p>I dont yet subscribe to the "everything is an Object" type philosophy,
but I can appreciate the power in thinking that way, and am enjoying the challenges
of learning the methodology. However, most OO languages expect an objects lineage
to be preordained by the God programmer with respect to whatever system he
is working on. The fact an Employee isa Trainspotter is of little relevence
to a Payroll program, and so in somewhat contrived ecosystems, there is no problem.</p>
<p>But what of other domains like AI, Neural Networks, Bioinformatics, Distributed
computing, Peer-to-Peer?. The latter is more where my interest lies, and I often
find that a clear line of relationship cannot be predefined. Sure, once there
is a relationship you can make pretty tree diagrams, but that is again, based
on perspective.</p>
<p>I am not a professional programmer or formally trained. I think of Perl more
as an intillectual game than a tool for parsing log files. This is why I love
Perlmonks - theres loads of theory up for grabs. </p>
<p>So, theorhetically, is manipulating an objects inheritence based on how it
is currently being percieved, a worthwhile cause for meditation?</p>
<p><em>maybe there is somewhere I can read up on stuff like this?</em></p>
<p>Thankyou for any time</p>