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

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

Open
p6rt opened this issue Oct 29, 2015 · 3 comments
Open

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

p6rt opened this issue Oct 29, 2015 · 3 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Oct 29, 2015

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

Searchable as RT126492$

@p6rt
Copy link
Author

@p6rt p6rt commented Oct 29, 2015

From @lizmat

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

@p6rt
Copy link
Author

@p6rt p6rt commented May 11, 2016

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
Copy link
Author

@p6rt p6rt commented May 11, 2016

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

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.