Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

native str attributes default to null instead of empty string #4690

Open p6rt opened 9 years ago

p6rt commented 9 years ago

Migrated from rt.perl.org#126492 (status was 'open')

Searchable as RT126492$

p6rt commented 9 years ago

From @lizmat

[21​:38​:17] \ m​: use nqp; class A { has str $!a; method BUILD() { nqp​::chars($!a) } }; A.new # tada [21​:38​:18] \<+camelia> rakudo-moar 3cc195​: OUTPUT«(signal SEGV)» [21​:38​:46] \ m​: use nqp; my str $foo; say $foo [21​:38​:46] \<+camelia> rakudo-moar 3cc195​: OUTPUT«␤» [21​:39​:05] \ I always thought that native strings initialized to the empty string ? [21​:39​:23] \ jnthn​: ^^^ ?? [21​:39​:46] \ lizmat​: In Rakudo I think we make that happen. [21​:39​:50] \ In NQP maybe not [21​:39​:51] \ m​: use nqp; my str $foo; say nqp​::chars($foo) [21​:39​:51] \<+camelia> rakudo-moar 3cc195​: OUTPUT«0␤» [21​:40​:17] \ apparently it only goes wrong with native string attributes ? [21​:40​:41] \ jnthn​: this is rakudo, so bug? [21​:41​:39] \ lizmat​: oh, mis-read... [21​:41​:58] \ Yeah, bug then [21​:42​:10] \ ok, will rakudobug it

p6rt commented 8 years ago

From @smls

Doesn't segfault for me on...

  Rakudo version 2016.04-155-gdc7346b built on MoarVM version 2016.04   implementing Perl 6.c.

...and instead prints this error​:

  ➜ use nqp; my str $a; say nqp​::chars($a);   0   ➜ use nqp; class A { has str $!a; method BUILD() { nqp​::chars($!a) } }; A.new;   chars requires a concrete string, but got null

I'm renaming the ticket accordingly.

p6rt commented 8 years ago

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