You've managed to sidetrack most people with the mention of "predeclare". What you really want to know is "Can you pass arguments to a method without using parens?" The answer is "no".
At least part of the reason that the answer is "no" is that, in Perl5, methods are often used as accessors for member variables so it is convenient to write:
without needing parens. So we can't make that last line start parsing as: $width= $obj->right( - $obj->left ); But you'd like to have that as an option. Well, we can consider making that option apply to a scope (like use strict), to a class, to an object, or to a method. But this option has to be determined at compile time otherwise we wouldn't be able to compile our example line. And Perl does late binding so we can't determine the class, object, nor method at compile time (we can often determine the method name at compile time but we can't determine what class it belongs to and making all methods named "size" not require parens no matter what class they are for just doesn't make much sense). So the only possibility would be to make this option apply to a given scope.$width= $obj->width; $width= $obj->right - $obj->left;
So now you can start working on that patch to add a new "compiler hint" bit to implement this. (:
- tye (but my friends call me "Tye")In reply to (tye)Re: Can One Predeclare a Package's Methods?
by tye
in thread Can One Predeclare a Package's Methods?
by sierrathedog04
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |