[perl #132053] [BUG] Autovivification on element with [] or {} as default causes "secret" keys

2017-09-11 Thread jn...@jnthn.net via RT
On Sat, 09 Sep 2017 19:53:53 -0700, tomentiru...@gmail.com wrote: > > my @h is default([]) > [] > > @h[0].push: 3 > [3] > > @h > [] > > @h[0] > [3] > > > my %h is default({}) > {} > > %h = 3 > 3 > > %h > {} > > %h > {b => 3} > > The array/hash variable's default is an empty array/hash literal. If

[perl #132053] [BUG] Autovivification on element with [] or {} as default causes "secret" keys

2017-09-11 Thread jn...@jnthn.net via RT
On Sat, 09 Sep 2017 19:53:53 -0700, tomentiru...@gmail.com wrote: > > my @h is default([]) > [] > > @h[0].push: 3 > [3] > > @h > [] > > @h[0] > [3] > > > my %h is default({}) > {} > > %h = 3 > 3 > > %h > {} > > %h > {b => 3} > > The array/hash variable's default is an empty array/hash literal. If

[perl #132053] [BUG] Autovivification on element with [] or {} as default causes "secret" keys

2017-09-10 Thread via RT
# New Ticket Created by Andrew Buchanan # Please include the string: [perl #132053] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=132053 > > my @h is default([]) [] > @h[0].push: 3 [3] > @h [] > @h[0] [3] > my %h is default(

[perl #132053] [BUG] Autovivification on element with [] or {} as default causes "secret" keys

2017-09-10 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Heh. FWIW we had this since forever: https://gist.github.com/Whateverable/78168042a011e01fc768c042b0d91898 On 2017-09-09 19:53:53, tomentiru...@gmail.com wrote: > > my @h is default([]) > [] > > @h[0].push: 3 > [3] > > @h > [] > > @h[0] > [3] > > > my %h is default({}) > {} > > %h = 3 > 3 > > %h

[perl #130293] is default on a hash prevents autovivification, but doesn't work on its own either

2016-12-07 Thread via RT
# New Ticket Created by Moritz Lenz # Please include the string: [perl #130293] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130293 > moritz: m: my %h is default([]); %h.push: 1; %h.push: 2; say %h camelia: rakudo-moar 2d019

[perl #84000] [TODO] Autovivification to make push %h, 5 work in Rakudo

2012-11-14 Thread Will Coleda via RT
for that. They are just fudged :-) > > Seems to work now: > > > my %g; push %g, 5; say %g.perl > ("gamme" => [5]).hash > > Tagging testneeded. > > /jnthn > Found skipped tests in S09-autovivification/autovivification.t, fixed & unfudged them. -- Will "Coke" Coleda

[perl #84000] [TODO] Autovivification to make push %h, 5 work in Rakudo

2011-02-12 Thread Carl Mäsak
# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #84000] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=84000 > Another newbie question: my %g; %g.[].push(5) doesn't auto-vivify hash element gamma. S

[perl #61740] Rakudo doesn't understand autovivification of multiple hash indexes

2010-07-24 Thread Will Coleda via RT
This test is in t/spec and is currently unfudged. Closing ticket, thanks for the report! -- Will "Coke" Coleda

[perl #76492] [TODO] implement autovivification of invocants

2010-07-14 Thread via RT
# New Ticket Created by Moritz Lenz # Please include the string: [perl #76492] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=76492 > > my %h; %h.push: 5; say %h.perl Method 'push' not found for invocant of class '' Expect

[perl #62948] [PATCH] some array autovivification fixes/improvements

2009-01-31 Thread via RT
ut breaking anything. There are other possible approaches to the problem. Since it also fixes the problem with print/say I also include a patch to remove the changes to print that are no longer needed. Tests for related conditions were already in array_extending.t so I include a patch that puts m

Re: Bug or feature? Hash autovivification

2009-01-01 Thread Patrick R. Michaud
On Wed, Dec 31, 2008 at 08:06:48AM -0800, Ovid wrote: > Just stumbled across this, but I can't tell from S09 if this is a bug or > feature: > > $ ./perl6 -e 'my %foo; if %foo {}; say %foo.perl' > {"a" => undef} It's a bug. In order to simplify the slicing implementation Rakudo currently aut

Re: Bug or feature? Hash autovivification

2008-12-31 Thread Larry Wall
On Wed, Dec 31, 2008 at 08:06:48AM -0800, Ovid wrote: : Just stumbled across this, but I can't tell from S09 if this is a bug or feature: : : $ ./perl6 -e 'my %foo; if %foo {}; say %foo.perl' : {"a" => undef} Definitely bug. Rvalues aren't supposed to autovivify. Larry

Bug or feature? Hash autovivification

2008-12-31 Thread Ovid
Just stumbled across this, but I can't tell from S09 if this is a bug or feature: $ ./perl6 -e 'my %foo; if %foo {}; say %foo.perl' {"a" => undef} I wasn't expecting auto-vivification there. The examples in S09 use HoH instead of a flat hash: But these bindings do autovivify:

[perl #61740] Rakudo doesn't understand autovivification of multiple hash indexes

2008-12-26 Thread via RT
# New Ticket Created by Ilya Belikin # Please include the string: [perl #61740] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61740 > Hi! r34346: > my %h; %h = 1; Method 'postcircumfix:{ }' not found for invocant of class

Re: [perl #58372] Autovivification

2008-08-26 Thread Moritz Lenz
ior is to immediately throw an exception here. Your analysis is certainly right in this case, but note that it doesn't work in other cases either: > "a" ~~ /a/; say $ get_pmc_keyed() not implemented in class 'Undef' > my %h; say %h get_pmc_keyed() not implemented in cla

Re: User defined autovivification

2005-08-28 Thread Yuval Kogman
27;t change the semantics: "this is an hash of sets" ... "this is what a set contains" vs. "this is a hash" ... "if there is no set make one, and this is what a set contains" but just the syntax. &g

User defined autovivification

2005-08-28 Thread Yuval Kogman
Today I wrote some perl 5 code that looked like this: my %index_by_x; my %index_by_y; my %index_by_z; foreach my $thing (@things){ ( $index_by_x{$thing->x_value} ||= Set::Object->new)->insert($thing); ( $index_by_y{$thing->y_value}

Re: Autovivification (was Re: E6: assume nothing)

2003-09-26 Thread Paul Hodges
ooey!" > : if exists $a{b}' > : > : perlfunc says: > : > : This surprising autovivification in what does not at first--or > : even second--glance appear to be an lvalue context may be fixed > : in a future release. > > I sure hope so. Perl 5 confuses reference

Re: Autovivification (was Re: E6: assume nothing)

2003-09-25 Thread Larry Wall
On Mon, Sep 08, 2003 at 11:18:12AM +0200, Paul Johnson wrote: : By the way, I trust this will be addressed (if it hasn't been already): : : perl5 -le 'print "gah!" if exists $a{b}{c}; print "phooey!" if exists $a{b}' : : perlfunc says: : : This surprising a

Autovivification (was Re: E6: assume nothing)

2003-09-08 Thread Paul Johnson
rust this will be addressed (if it hasn't been already): perl5 -le 'print "gah!" if exists $a{b}{c}; print "phooey!" if exists $a{b}' perlfunc says: This surprising autovivification in what does not at first--or even second--glance appear to be an lvalue c

Re: Autovivification

2002-11-12 Thread Larry Wall
rtually no" because one could make the argument that you don't : know if we wanted a standard array or a typed one.) I would not tie autovivification to typing. Autovivification only makes sense when there's an existing value you need to construct a location for, so it really only makes

RE: Autovivification

2002-11-11 Thread Erik Steven Harrison
-- On Mon, 11 Nov 2002 13:02:12 Brent Dax wrote: >Erik Steven Harrison: ># >I think that, if Perl can determine the type with virtually no ># >ambiguity, it should autovivify. ># ># Actually, this behavior has already (mostly) been decided over in P6 ># language. It was decided (and I agre

RE: Autovivification

2002-11-11 Thread Brent Dax
Erik Steven Harrison: # >I think that, if Perl can determine the type with virtually no # >ambiguity, it should autovivify. # # Actually, this behavior has already (mostly) been decided over in P6 # language. It was decided (and I agree) that the Perl 5 behavior of Can you give me a link or a

RE: Autovivification

2002-11-10 Thread Erik Steven Harrison
e concept ># is being taught at a time. Probably. > >OK. I'm trying to do that in the stuff I'm writing. > ># > =head3 Autovivification ># > @{%anagrams{$key}}.push $word; ># > $undefined_var[$idx]=$scalar; ># ># Hmm, not a clue. I could

RE: Autovivification

2002-11-09 Thread Brent Dax
#x27;m writing. # > =head3 Autovivification # > @{%anagrams{$key}}.push $word; # > $undefined_var[$idx]=$scalar; # # Hmm, not a clue. I could argue that one both ways. Perhaps (thinking # aloud) they only autovivify if you've explicitly called out # the exact t

Re: Autovivification

2002-11-09 Thread Michael Lazzaro
ldoc writing style (booklike, informal) is probably exactly what we want, yes? We'll just break it up into *much* smaller individual sections, so that only one concept is being taught at a time. Probably. > =head3 Autovivification > @{%anagrams{$key}}.push $word; > $undefined_va

Autovivification

2002-11-09 Thread Brent Dax
I was writing up some docs (in a perldoc-like style--we can always change the form later, but the content is important), and started working on documenting references. I ended up with this bit: *** BEGIN DOCS *** =head3 Autovivification Actually, one of the features of the extra-sigil

Re: Autovivification behavior

2001-01-21 Thread Deven T. Corzine
gt; > reference to an undefined substructure sets a flag and saves the expression > > for the lvalue, returning undef whenever evaluated in a read-only context > > and autovivifying when necessary to write to the lvalue? > > > > Deven > > > Lazy autovivification could

Re: Autovivification behavior

2001-01-21 Thread David L. Nicol
the expression > for the lvalue, returning undef whenever evaluated in a read-only context > and autovivifying when necessary to write to the lvalue? > > Deven Lazy autovivification could work by adding an on-assignment magic to the previously nonexistent SV, which details the crea

Re: Autovivification behavior

2000-12-23 Thread Deven T. Corzine
On Sat, 23 Dec 2000, Graham Barr wrote: > This has been discussed on p5p many many times. And many times > I have agreed with what you wrote. However one thing you did not mention, > but does need to be considered is > > func($x{1}{2}{3}) > > at this point you do not know if this is a read o

Re: Autovivification behavior

2000-12-23 Thread Graham Barr
This has been discussed on p5p many many times. And many times I have agreed with what you wrote. However one thing you did not mention, but does need to be considered is func($x{1}{2}{3}) at this point you do not know if this is a read or write access as the sub could do $_[0] = 'fred'. If th

Autovivification behavior

2000-12-22 Thread Deven T. Corzine
def 1 undef 2 undef 3 ARRAY(0x829a554) empty array Now, I understand why this happens, but is it really a good thing that it happens in the first? We're not storing into the nonexistent substructures (in which case you DO want autovivification, of course), only attempting to a