Skip to content
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

Grapheme boundaries not recalculated for string repetition #5748

Closed
p6rt opened this issue Oct 14, 2016 · 11 comments
Closed

Grapheme boundaries not recalculated for string repetition #5748

p6rt opened this issue Oct 14, 2016 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 14, 2016

Migrated from rt.perl.org#129878 (status was 'resolved')

Searchable as RT129878$

@p6rt
Copy link
Author

p6rt commented Oct 14, 2016

From cygx@cpan.org

Cf

  say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" x 2).chars #=> 2

vs

  say ([~] "\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2).chars #=> 1

@p6rt
Copy link
Author

p6rt commented Dec 27, 2016

From @samcv

On Fri, 14 Oct 2016 11​:06​:54 -0700, cygx@​cpan.org wrote​:

Cf

say \("\\c\[REGIONAL INDICATOR SYMBOL LETTER G\]" x 2\)\.chars \#=> 2

vs

say \(\[~\] "\\c\[REGIONAL INDICATOR SYMBOL LETTER G\]" xx 2\)\.chars \#=> 1

What is going on here is not a bug in string repetition, but a bug in
converting from List to a Str object.

say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2).elems #> 2
say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2)[0].ords #> 127468
say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2)[0].chars #> 1

say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2).Str.ords #> (127468 32
127468)

It is adding in a space between the characters when turning it from a List
into a Str.

Will hopefully get more time to look into this bug later.

@p6rt
Copy link
Author

p6rt commented Dec 27, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 27, 2016

From @samcv

Actually this is not a bug at all, and it is not limited to those characters.

If you do ('a' xx 2).chars you will get 3 as well. If you want to join the list after you create it​:

say ('a' xx 2).join.chars #> 3

Rejecting.

@p6rt
Copy link
Author

p6rt commented Dec 27, 2016

@samcv - Status changed from 'open' to 'rejected'

@p6rt
Copy link
Author

p6rt commented Dec 30, 2016

From @samcv

17​:54Z <cygx> samcv​: I believe you misread RT #​129878 - the issue is not stringifying a list generated by xx (did you miss the [~]), but the string generated by x

Looks like I made a mistake, re-opening this. Will have to look more into it. Thanks for pointing it out.

@p6rt
Copy link
Author

p6rt commented Dec 30, 2016

@samcv - Status changed from 'rejected' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 6, 2017

From @coke

On Fri, 14 Oct 2016 11​:06​:54 -0700, cygx@​cpan.org wrote​:

Cf

say \("\\c\[REGIONAL INDICATOR SYMBOL LETTER G\]" x 2\)\.chars \#=> 2

vs

say \(\[~\] "\\c\[REGIONAL INDICATOR SYMBOL LETTER G\]" xx 2\)\.chars \#=> 1

With a recent rakudo, these now both output 1

say ("\c[REGIONAL INDICATOR SYMBOL LETTER G]" x 2).chars
1
say ([~] "\c[REGIONAL INDICATOR SYMBOL LETTER G]" xx 2).chars
1

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 7, 2017

From @smls

On Wed, 06 Sep 2017 15​:20​:17 -0700, coke wrote​:

With a recent rakudo, these now both output 1

Bisectable shows that it was fixed during recent MoarVM changes​:

  https://gist.github.com/Whateverable/01a82d07e8009c7beffe5893432dddf2
  rakudo/rakudo@593fa5f

Among the listed MoarVM commits, this one seems to be the most likely candidate based on its commit message​:

  MoarVM/MoarVM@62f66cbf

Marking this ticket TESTNEEDED.

@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

From @samcv

On Thu, 07 Sep 2017 09​:52​:07 -0700, smls75@​gmail.com wrote​:

On Wed, 06 Sep 2017 15​:20​:17 -0700, coke wrote​:

With a recent rakudo, these now both output 1

Bisectable shows that it was fixed during recent MoarVM changes​:

https://gist.github.com/Whateverable/01a82d07e8009c7beffe5893432dddf2
rakudo/rakudo@593fa5f

Among the listed MoarVM commits, this one seems to be the most likely
candidate based on its commit message​:

MoarVM/MoarVM@62f66cbf

Marking this ticket TESTNEEDED.

Yes you are correct that that is the MoarVM commit where I fixed it :-)

I added tests here​: Raku/roast@1e4fd21486

Closing this now :-)

@p6rt p6rt closed this as completed Oct 4, 2017
@p6rt
Copy link
Author

p6rt commented Oct 4, 2017

@samcv - Status changed from 'open' to 'resolved'

@p6rt p6rt added the uni label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant