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

After declaring my @x; @x.defined returns true and should not #937

Closed
p6rt opened this issue Apr 22, 2009 · 4 comments
Closed

After declaring my @x; @x.defined returns true and should not #937

p6rt opened this issue Apr 22, 2009 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 22, 2009

Migrated from rt.perl.org#64968 (status was 'rejected')

Searchable as RT64968$

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

From @ronaldxs

From IRC below

19​:07 PhatEddy rakudo​: my @​x; say 'ok' if @​x.defined
19​:07 p6eval rakudo 69b318​: OUTPUT«ok?»

The equivalent Perl 5 code says nothing unless you put something in @​x
at some point.

This is similar to some other tickets like Rt 64928
<http://rt.perl.org/rt3//Public/Bug/Display.html?id=64928> and the
resolved Rt 62894
<http://rt.perl.org/rt3/Public/Bug/Display.html?id=62894> but seemed
somehow basic and distinct enough that, after asking on IRC, I am
submitting this as a new bug ...

@p6rt
Copy link
Author

p6rt commented Apr 2, 2010

From @masak

On Wed Apr 22 06​:25​:42 2009, ronaldxs wrote​:

From IRC below

19​:07 PhatEddy rakudo​: my @​x; say 'ok' if @​x.defined
19​:07 p6eval rakudo 69b318​: OUTPUT«ok?»

The equivalent Perl 5 code says nothing unless you put something in @​x
at some point.

This is similar to some other tickets like Rt 64928
<http://rt.perl.org/rt3//Public/Bug/Display.html?id=64928> and the
resolved Rt 62894
<http://rt.perl.org/rt3/Public/Bug/Display.html?id=62894> but seemed
somehow basic and distinct enough that, after asking on IRC, I am
submitting this as a new bug ...

I would say that it's similar to #​64928, but unlike #​62894.

Essentially, normal arrays (and hashes) are always defined in Perl 6. Even when they're empty,
they're defined. Even when they've only been declared but not-yet-assigned to, they're
defined. At least that's how I understand their semantics.

In other words, this is one of a number of differences between Perl 5 and Perl 6, and the way
Rakudo currently works is correct. Marking the ticket as rejected.

@p6rt
Copy link
Author

p6rt commented Apr 2, 2010

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

@p6rt
Copy link
Author

p6rt commented Apr 2, 2010

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

@p6rt p6rt closed this as completed Apr 2, 2010
@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
Labels
Projects
None yet
Development

No branches or pull requests

1 participant