On Nov 30, 2005, at 2:50 PM, Patrick R. Michaud wrote:
On Wed, Nov 30, 2005 at 11:00:36AM -0800, Chip Salzenberg wrote:
On Wed, Nov 30, 2005 at 12:18:40PM +0100, Leopold Toetsch wrote:
Parrot didn't throw exceptions on param or result count mismatch
until now, and still doesn't. [1]
[1] all PGE and PGE-based stuff is failing, when both are turned on
...
Allowing too few parameters is already possible through the extensive
use of :optional. As for the too-many case: If we add a :last flag
which means "any additional incoming values should be ignored", then
that's covered too. Then users can avoid throwing exceptions in all
cases, if that's what they want.
Patrick, would that work for you? For that matter, did you know that
your code dies when parameter counts are enforced?
Yes, I knew that some code pieces would have trouble when parameter
counts
were enforced, but I figured I'd cross that bridge when we came to it.
I guess we're there now.
Short answer: something like a ":last" flag would be excellent.
Longer answer: In PGE, each rule is a parrot sub, and some rules
can be parameterized by various parameters, which means that the
number
of arguments to a rule can vary depending on the rule and the
context in which it can be called. So, there's not a hard-and-fast
parameter list that is going to work in all situations and provide
the flexibility we'll want. Thus, we really ought to have a way to
indicate that a rule (parrot sub) can still be safely run even if
called with more parameters than it expects.
Isn't this what :slurpy is for? How else would you even use extras?
In the meantime, I'll go ahead and see about updating PGE so that
any extra params from callers don't cause much grief.
Pm