problem-solving
problem-solving copied to clipboard
Making a signature accept a list of Pairs
https://colabti.org/irclogger/irclogger_log/raku?date=2020-04-20#l387
m: sub a([$a]) { dd $a }; a [1]; a [1 => 2]
23:35 C<camelia> combined, experimental evalbot rakudo-moar b0a720cb6: OUTPUT: «1Too few positionals passed to 'a'; expected 1 argument but got 0 in sub-signature in sub a at <tmp> line 1 in block <unit> at <tmp> line 1»
I think having List.Capture automatically promote any Pair in the list into a named argument was probably a mistake (one of mine too, maybe I need to borrow rule 2 for a moment... :-))
The remaining question is how we can change this without inflicting breakage. There's two scenarios:
- We try and change it. We blin it. We find nothing at all depended on the current semantics. We say, eh, cheating is technique, and just change it.
- We start passing a named argument to
.Capturein signature binding to indicate old vs. new semantics, depending on the language version the signature shows up in.
Ah, and I hereby delegate the research to find out which of 1 or 2 we have to do, to somebody enthusiastic about it. :-)