Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Str ~~ Range(with Str end points) gives wrong results #6137
The smartmatch needs to give True, as the element is present in that range:
20:18 IOninja m: say "1117-11" ~~ "1126-12" .. "2017-11"
The issue is that `before`/`after` comparators are used and the comparison gives False, because
20:19 s: "1126-12" .. "2017-11", 'ACCEPTS', \("1117-11")
P.S.: Range looks like it's itching to split into Int, Numeric, and Str subclasses (with Ranged role tying them up or something).
P.P.S.: confusion with string Ranges is common, perhaps the weird stuff should be left to the sequence op,
FWIW, I’ve already tried the IntRange approach about 2 years ago. It was shot down then. Maybe things have changed. I certainly hope so.