petdance/scratch — Issue #1175: Duplicate named args cause fatal error in subs
Author: petdance
Created: 2011-11-01 05:39:30+00:00
State: open
Labels: bug, Pri-normal, Sev-medium

Calling a sub with duplicate named args:
{{{
.sub main :main
foo( 1 :named('a'), 2 :named('a') )
.end
}}}
triggers an error:
{{{
duplicate named argument in call
current instr.: 'main' pc 0 (test.pir:4)
}}}

Unfortunately, this means that setting defaults in a hash, then flattening the hash together with any explicit named args, is no longer a valid way to handle argument defaulting.

Given that, either (1) this is a bug, and duplicate named args should be permitted; or (2) this is the official new way, in which case what is the model for arg-defaulting?

Originally http://trac.parrot.org/parrot/ticket/1515