|Perl: the Markov chain saw|
Good question... :)
I guess I'm trying to make my code (modules) easier to use for both myself and others; if the the method is used incorrectly, and the program when runs tells me 'hey don't do that, you should use me in this and that way' it would cut down substantially on my debugging hours...
But it's quite true that as soon as your code works, the whole checking becomes quite useless...
Invoking the methods would still work exactly the same way, but if the 'modifiers' indicate that the method 'expects' a certain kind of first argument (be it class, object or either), the method could check to see if that's ok, and if not, croak.
Almost every way of using the methods would still work. The only thing that might not, would be 'borrowing' methods from other modules/classes without using inheritancy. But I can't help feeling that doing something like that indicates a design flaw anyway...
So yes, I would like to have the option to have Perl behave a bit like some other language... But then again, aren't most good things based in part on a collection of other good things? If I remember correctly, Larry was using sed and awk, but needed more... So he invented Perl and borrowed a bunch of the functionality from those tools amongst others. Which is great! I love it!
It's not like I'm saying "Hey Perl should change, and everyone should do this!"... But traversing @ISA, and the UNIVERSAL class seem to be considered standard perl, and you are allowed, not obliged to use them... I would think being allowed (but not obliged) to use features such as the modifiers I suggested would further extend the freedom a Perl programmer has to build 'mean & clean' OO code...
Everyone seems to be asking "Why do you want to be able to do this?"... Well, I would ask "Why would you not want to be able to do this?". Right now I'm doing it manually anyway... :)
So either I'm just not getting what the 'evilness' is in my idea (even though I read every reply at least twice), or I just don't agree... :)