TSa wrote: > I see no problem as long as say gets a pair as argument. Then it can > print the key and value separated with a tab. More problematic are > string concatenations of the form > > say "the pair is: " ~ (foo => $bar); > > which need to be written so that say sees the pair > > say "the pair is: ", (foo => $bar); > > and not a string that only contains the value of the pair. I'm not > sure if the parens are necessary to pass the pair to say as argument > to be printed instead of a named argument that influences how the > printing is done.
That's a good point. Is there an easy way to distinguish between passing a pair into a positional parameter vs. passing a value into a named parameter? My gut instinct would be to draw a distinction between the different forms that Pair syntax can take, with "foo => $bar" being treated as an instance of the former and ":foo($bar)" being treated as an instance of the latter. That is: say 'the pair is: ', foo => $bar; would be equivalent to: say 'the pair is: ', "foo\t$bar\n"; while: say "the pair is: ", :foo($bar); would pass $bar in as the value of the named parameter 'foo' (which, I believe, would cause 'say' to squawk, as its signature doesn't allow for a named parameter 'foo'). -- Jonathan "Dataweaver" Lang