> <matthew mark luke john>.unique(as => *.chars).sort(by => *.chars)
(mark matthew)
Ahh good, my code works... except it's not really sorting by chars here because unlike unique
, sort
takes a code block not a named parameter. However there is no error to indicate this is not DWIM. It just silently sorts Naturally.
If your data happens to sort Naturally in the same order your by
option would have sorted it - and you don't notice - you now have a bug laying dormant in your code that could go unnoticed indefinitely.
Sort should either handle this syntax, or otherwise throw up a warning;
I brought this up on #perl6
on 2016-04-10 and 2016-04-11 but no solution proposed.
This has confused another person here
moritz said
Maybe
unique
needs a multi that accepts a positional&as
, considering it's used way more than:&with
, and it would make it more consistent with other List-y methods likesort
,map
,grep
,classify
, etc.