Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #118031] Cannot .new / .clone TypedHash without losing typing

1 view
Skip to first unread message

Elizabeth Mattijsen

unread,
May 17, 2013, 6:45:50 AM5/17/13
to bugs-bi...@rt.perl.org
# New Ticket Created by Elizabeth Mattijsen
# Please include the string: [perl #118031]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=118031 >


[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)␤»

jnthn@jnthn.net via RT

unread,
Oct 27, 2015, 11:15:02 AM10/27/15
to perl6-c...@perl.org
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.

0 new messages