|No such thing as a small change|
Re^5: use fields; # damnitby stvn (Monsignor)
|on Aug 21, 2004 at 00:42 UTC||Need Help??|
The syntax my Dog $brain declares that $brain is a Dog, and therefore everything that can be done with $brain has to be something that a Dog can do.
But then how come this works without error? (assuming that the method getCells is declared in Brain)
Are you just speaking theoretically? Or are you just refering to class fields and not methods? If that is so, then where is the real benefit in this? It seems I have to write code like this, to see any benefit.
And to me that defeats so much of what makes OO good (yes I know I am being a purist, but hey, its my opinion).
These are compile-time tests on the container $brain.
So what is it checking then at compile time, if it cannot see the value I put in there and know its wrong? Is is only checking the underlying "hash" and access to that?
after all nothing stops someone from making a class that inherits from both Dog and Brain!
So it does not check the @ISA at all then either? Hmmm.
Now I know that perl (like LISP, Python and others) is a more dynamic langauge than say Java, C# or even Ada95. And I know that to add something like "strong" typing would make much of what makes perl so cool just about impossible. But you don't need "strong" typing to get the benefits of type "safety". Type inference in Standard ML works just fine and IMO is superior to "strong" typing (and much simplier to use too). It seems to me that maybe fields and its accompanying technology is not finished yet, and if it is, then its not what I am looking for.