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

Cannot .new / .clone TypedHash without losing typing #3138

Closed
p6rt opened this issue May 17, 2013 · 5 comments
Closed

Cannot .new / .clone TypedHash without losing typing #3138

p6rt opened this issue May 17, 2013 · 5 comments

Comments

@p6rt
Copy link

p6rt commented May 17, 2013

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

Searchable as RT118031$

@p6rt
Copy link
Author

p6rt commented May 17, 2013

From @lizmat

[12​:36​:12] <lizmat> r​: my %h{Any}; my %i=%h.new; say %h.WHAT; say %i.WHAT # did we agree that this was a rakudobug?
[12​:36​:14] <+camelia> rakudo 570d1d​: OUTPUT«(Hash+{TypedHash})␤(Hash)␤»
[12​:44​:27] <lizmat> r​: my %h{Any}; my %i=%h.clone; say %h.WHAT; say %i.WHAT # it also goes wrong for .clone, I assume because it uses .new
[12​:44​:28] <+camelia> rakudo 570d1d​: OUTPUT«(Hash+{TypedHash})␤(Hash)␤»

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

From @Mouq

Not sure if this worked before, but these examples work fine if one uses binding instead of assignment.

On Fri May 17 03​:45​:49 2013, elizabeth wrote​:

[12​:36​:12] <lizmat> r​: my %h{Any}; my %i=%h.new; say %h.WHAT; say
%i.WHAT # did we agree that this was a rakudobug?
[12​:36​:14] <+camelia> rakudo 570d1d​:
OUTPUT«(Hash+{TypedHash})␤(Hash)␤»

03​:52 <Mouq> m​: my %h{Any}; my %i​:=%h.new; say %h.WHAT; say %i.WHAT
03​:52 <camelia> rakudo-moar e84f71​: OUTPUT«(Hash[Any,Any])␤(Hash[Any,Any])␤»

[12​:44​:27] <lizmat> r​: my %h{Any}; my %i=%h.clone; say %h.WHAT;
say %i.WHAT # it also goes wrong for .clone, I assume because it uses
.new
[12​:44​:28] <+camelia> rakudo 570d1d​:
OUTPUT«(Hash+{TypedHash})␤(Hash)␤»

03​:52 <Mouq> m​: my %h{Any}; my %i​:=%h.clone; say %h.WHAT; say %i.WHAT
03​:52 <camelia> rakudo-moar e84f71​: OUTPUT«(Hash[Any,Any])␤(Hash[Any,Any])␤»

Since %i is a normal Hash by default, can this be closed with tests?

@p6rt
Copy link
Author

p6rt commented Mar 12, 2015

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

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

From @jnthn

On Wed Mar 11 20​:54​:04 2015, Mouq wrote​:

Not sure if this worked before, but these examples work fine if one
uses binding instead of assignment.

On Fri May 17 03​:45​:49 2013, elizabeth wrote​:

[12​:36​:12] <lizmat> r​: my %h{Any}; my %i=%h.new; say %h.WHAT;
say
%i.WHAT # did we agree that this was a rakudobug?
[12​:36​:14] <+camelia> rakudo 570d1d​:
OUTPUT«(Hash+{TypedHash})␤(Hash)␤»

03​:52 <Mouq> m​: my %h{Any}; my %i​:=%h.new; say %h.WHAT; say %i.WHAT
03​:52 <camelia> rakudo-moar e84f71​:
OUTPUT«(Hash[Any,Any])␤(Hash[Any,Any])␤»

[12​:44​:27] <lizmat> r​: my %h{Any}; my %i=%h.clone; say %h.WHAT;
say %i.WHAT # it also goes wrong for .clone, I assume because it
uses
.new
[12​:44​:28] <+camelia> rakudo 570d1d​:
OUTPUT«(Hash+{TypedHash})␤(Hash)␤»

03​:52 <Mouq> m​: my %h{Any}; my %i​:=%h.clone; say %h.WHAT; say %i.WHAT
03​:52 <camelia> rakudo-moar e84f71​:
OUTPUT«(Hash[Any,Any])␤(Hash[Any,Any])␤»

Since %i is a normal Hash by default, can this be closed with tests?

Yes, the binding/assignment distinction here is important, and Rakudo's behavior is by design. Added tests to S09-typed-arrays/hashes.t to codify this.

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

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

@p6rt p6rt closed this as completed Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant