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

Capture.WHICH does not distinguish rw arguments #6133

Closed
p6rt opened this issue Mar 8, 2017 · 5 comments
Closed

Capture.WHICH does not distinguish rw arguments #6133

p6rt opened this issue Mar 8, 2017 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 8, 2017

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

Searchable as RT130954$

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

From @smls

  my $x = 42;

  my $c1 = \($x);
  my $c2 = \(42);

  say $c1 eqv $c2; # True
  say $c1 === $c2; # True
  say $c1.WHICH; # Capture|(Int|42)
  say $c2.WHICH; # Capture|(Int|42)

Since the two captures in this example are not identical behavior-wise
(e.g. $c1 could be bound to the signature `$foo is rw` but $c2 can't),
their `.WHICH` and `===` shouldn't consider them identical either,
right?

`eqv` returning `True` seems appropriate though, as it does the same for Lists​:

  my $l1 = ($x,);
  my $l2 = (42,);

  say $l1 eqv $l2; # True
  say $l1 === $l2; # False
  say $l1.WHICH; # List|62518880
  say $l2.WHICH; # List|62518928

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

@p6rt
Copy link
Author

p6rt commented Mar 8, 2017

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

@p6rt
Copy link
Author

p6rt commented Mar 18, 2017

From @zoffixznet

On Wed, 08 Mar 2017 03​:55​:38 -0800, smls75@​gmail.com wrote​:

my $x = 42;

my $c1 = \($x);
my $c2 = \(42);

say $c1 eqv $c2; # True
say $c1 === $c2; # True
say $c1.WHICH; # Capture|(Int|42)
say $c2.WHICH; # Capture|(Int|42)

Since the two captures in this example are not identical behavior-wise
(e.g. $c1 could be bound to the signature `$foo is rw` but $c2 can't),
their `.WHICH` and `===` shouldn't consider them identical either,
right?

`eqv` returning `True` seems appropriate though, as it does the same
for Lists​:

my $l1 = ($x,);
my $l2 = (42,);

say $l1 eqv $l2; # True
say $l1 === $l2; # False
say $l1.WHICH; # List|62518880
say $l2.WHICH; # List|62518928

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@4605d5219e
Tests​: Raku/roast@7cf30b225a

@p6rt p6rt closed this as completed Mar 18, 2017
@p6rt
Copy link
Author

p6rt commented Mar 18, 2017

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

@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