> On 8 Mar 2017, at 21:29, Zoffix Znet (via RT) <perl6-bugs-follo...@perl.org> > wrote: > > # New Ticket Created by Zoffix Znet > # Please include the string: [perl #130959] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=130959 > > > > 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" > 20:18 camelia rakudo-moar 3046d5: OUTPUT: «False» > 20:18 IOninja m: say "1117-11" ∈ "1126-12" .. "2017-11" > 20:18 camelia rakudo-moar 3046d5: OUTPUT: «True» > > The issue is that `before`/`after` comparators are used and the comparison > gives False, because > "1117-11" *is* before "1126-12" and supposedly out of range. > > 20:19 s: "1126-12" .. "2017-11", 'ACCEPTS', \("1117-11") > 20:19 SourceBaby IOninja, Sauce is at > https://github.com/rakudo/rakudo/blob/3046d57/src/core/Range.pm#L419 > 20:21 IOninja m: dd [ (not "1117-11" before "1126-12"), (not > "1117-11" after "2017-11") ] > 20:21 camelia rakudo-moar 3046d5: OUTPUT: «[Bool::False, > Bool::True]» > > P.S.: Range looks like it's itching to split into Int, Numeric, and Str > subclasses (with Ranged role tying them up or something).
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. > P.P.S.: confusion with string Ranges is common, perhaps the weird stuff > should be left to the sequence op, > with Range doing something very simple. Agree.