I have a suggestion/proposal/whatever.

I am just starting to get a grasp of uses for pairs and where they are
handy. Working on string.trans some showed that it would be useful to have
the function accept a list of pairs. That was working until the fix for
magical pairs went through and now the pairs in the call are treated as
named arguments. After some discussion with iblech and looking at the
Synopsis it looks like *%hash will slurp up named args into a hash and
[EMAIL PROTECTED] slurp up extra parameters. *%hash could work for trans except 
it
stringifies the left (or magic quotes or whatever the term is) and looses
order. Both of those are significant to trans and possibly other uses for
lists of pairs. So I was wondering if we could have a signature that meant
to slurp up named args and put them in a list as pairs. For now I suggest
[EMAIL PROTECTED], because it has the flattening connotation already and we are 
sort
of flattening a list of named args into a list of pairs.

The biggest issue I see with this is that i don't know how the key value of
named args is handled and if it is handled too soon to then be useful in a
pair.

Currently we (can|will be able to) do

"string".trans( (['h','e'] => "0") );
"string".trans( <== ['h','e'] => "0");

Those are fine and i can live with that, but it seems that if we made the
signature of trans

method trans(Str $self: [EMAIL PROTECTED]) {};

Then we could just do plain old:
"string".trans(['h','e'] => "0");

Which to me seems a lot easier to read. I would propose that it only effects
named params so that there is no concern about pairs in values and how to
handle them.

Reply via email to