New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version comparison confused by digit with diacritics #5422
Comments
From zefram@fysh.orgThe Version class accepts numeric components that contain digits with
The digit with diacritic effectively terminates the digit sequence, -zefram |
From @zoffixznetOn Tue, 05 Jul 2016 09:52:46 -0700, zefram@fysh.org wrote:
Thanks for the report, however, there's no bug here, as strings are valid The `leg` operator coerces Versions to strings, and in this case string With `cmp`, string parts are always Order::Less than number parts, so to <Zoffix> m: say Version.new("34\x[308]5") cmp Version.new("34\x[308]4") This also works with Version literals: Cheers, |
The RT System itself - Status changed from 'new' to 'open' |
@zoffixznet - Status changed from 'open' to 'rejected' |
From @zoffixznetA fair point. Re-opening with the intent to make synthetic digits match the same way as punctuation. I tried a few implementations, like changing the .comb to .comb(/:r ‘*’ || [(\d) <?{ nqp::iseq_s(nqp::chr(nqp::ord(nqp::substr($_, nqp::chars($_)-1, 1))), nqp::substr($_, nqp::chars( But all of them ended up being 10 to 64 times slower than just regular \d+. By defining a token that matches only non-synthetic Nd chars, the slowdown is only 2x, so I'll see if we can make that token available somewhere in the guts, since we needed it in the Perl6/Grammar.nqp too. |
@zoffixznet - Status changed from 'rejected' to 'open' |
From @samcvOn Sat, 26 Nov 2016 19:52:48 -0800, cpan@zoffix.com wrote:
This looks like a bug in cmp. <samcv> j: say Version.new("34\x[308]5") cmp Version.new("4") <samcv> m: say Version.new("34\x[308]5") cmp Version.new("4") In MoarVM we just check if the graphemes are numerically higher while going the length of the string, we need to not do this if there are diacritics. |
Migrated from rt.perl.org#128546 (status was 'open')
Searchable as RT128546$
The text was updated successfully, but these errors were encountered: