Ticket #1103 (closed deprecation: done)
Optional named parameters must be explicit
Reported by: | allison | Owned by: | nwellnhof |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | core | Version: | 1.6.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
In the old implementation of the calling conventions, there was a bug where extra named arguments would not be caught as an error if there were no named parameters in the called sub (even though they would be caught if there was at least one named parameter). This code example demonstrates the problem:
.sub main :main 'foo'('tene', 'wtf' => 'wtf') .end .sub 'foo' .param pmc name say name .end
The pcc_reapply branch fixed this bug, but unfortunately PGE was relying on the bug extensively to allow an optional named 'actions' argument to be passed to rules, and silently ignored when no named 'actions' parameter was defined in the rule.
We've inserted a hack in the branch (soon to be merged into trunk), to artificially reproduce the behavior of this bug. The hack will be removed after 2.0, and all optional named parameters will have to be declared in the sub.