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
KeyBag accepts non-UInt values in Rakudo #3115
Comments
From @masak<lizmat> more worringly: The spec says KeyBag defaults to UInt values. <lizmat> "A C<KeyHash> represents a mutable set of values, represented |
From @usev6This has changed. The former KeyBag is a BagHash now and the code snippet no longer generates a key "a" with a value "b". Instead it generates a key of type Pair ("a" => "b") with the corresponding value 1: $ perl6-m -e 'my $a = BagHash.new( (a=>"b") ); for $a.kv -> $key, $val { say $key, " isa ", $key.WHAT; say $val }' If I omit the parens around a=>"b" I get an empty BagHash: $ perl6-m -e 'my $a = BagHash.new( a=>"b" ); say $a.perl' That looks reasonable to me. Is the ticket closable with tests? |
1 similar comment
From @usev6This has changed. The former KeyBag is a BagHash now and the code snippet no longer generates a key "a" with a value "b". Instead it generates a key of type Pair ("a" => "b") with the corresponding value 1: $ perl6-m -e 'my $a = BagHash.new( (a=>"b") ); for $a.kv -> $key, $val { say $key, " isa ", $key.WHAT; say $val }' If I omit the parens around a=>"b" I get an empty BagHash: $ perl6-m -e 'my $a = BagHash.new( a=>"b" ); say $a.perl' That looks reasonable to me. Is the ticket closable with tests? |
@usev6 - Status changed from 'new' to 'open' |
From @masakbartolin (>):
Yes, I think so. |
From @usev6I added a test for the first example to S02-types/baghash.t with the following commit: Raku/roast@502f2ca59d After staring at it for a while I'm no longer convinced that the following should result in an empty BagHash: $ perl6-m -e 'my $a = BagHash.new( a=>"b" ); say $a.perl' Shouldn't that Hash get a Pair as it's first key as well? Compare the output with the a quoted. $ perl6-m -e 'my $a = BagHash.new( "a"=>"b" ); for $a.kv -> $key, $val { say $key, " isa ", $key.WHAT; say $val }' For the time being I'll leave the ticket open. |
1 similar comment
From @usev6I added a test for the first example to S02-types/baghash.t with the following commit: Raku/roast@502f2ca59d After staring at it for a while I'm no longer convinced that the following should result in an empty BagHash: $ perl6-m -e 'my $a = BagHash.new( a=>"b" ); say $a.perl' Shouldn't that Hash get a Pair as it's first key as well? Compare the output with the a quoted. $ perl6-m -e 'my $a = BagHash.new( "a"=>"b" ); for $a.kv -> $key, $val { say $key, " isa ", $key.WHAT; say $val }' For the time being I'll leave the ticket open. |
From @usev6FROGGS explained on #perl6 why the empty BagHash is correct: < FROGGS> bartolin: the bare a will result in a named argument, where the quoted "a" will construct a pair and pass that I'll add a second test to S02-types/baghash.t and close this ticket afterwards. |
1 similar comment
From @usev6FROGGS explained on #perl6 why the empty BagHash is correct: < FROGGS> bartolin: the bare a will result in a named argument, where the quoted "a" will construct a pair and pass that I'll add a second test to S02-types/baghash.t and close this ticket afterwards. |
From @usev6Well, I hope that's it: Raku/roast@9186415c7c |
@usev6 - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#117773 (status was 'resolved')
Searchable as RT117773$
The text was updated successfully, but these errors were encountered: