Front page | perl.perl5.porters |
Postings from January 2012
Re: [perl #107528] Autovivification should be ignored when testingfor existence
Thread Previous
|
Thread Next
From:
Phillip Moore
Date:
January 10, 2012 15:35
Subject:
Re: [perl #107528] Autovivification should be ignored when testingfor existence
Message ID:
CAJY0+QAOyZBbhLfZBehENernZdADGBmYzeXH1JxC+L8NtaErbA@mail.gmail.com
This is pretty amusing.... First of all, I am flattered that my 15
year old flame war with Chip over the introduction of autovivification
into perl5.004 (!!) is remembered by anyone. No apologies necessary.
Quite the contrary, I'm touched that you remembered.
I've been out of the perl5-porters loop for too long, and my knowledge
of perl internals too weak, to really contribute in a meaningful
fashion, though.
The issues I had at the time were primarily due to the fact that while
introducing autovivification was a Really Cool Thing, in terms of
moving the language forward, it was horribly incompatible with
existing perl code. That was really my issue, since this one change
meant that you had to PORT code from pre-5.004 to 5.004 (I might have
the release where this changed wrong -- my memory of flame wars from
the 90's is a little weak :-). If you had code that did this:
if ( $a->{b}->{c}->{d} ) {
do something important...
}
and the mere existence of the the intermediate references was
important, your code broke, and broke badly. Merely inspecting
something deep in a large data structure would have the side effect of
autovivifying all the intermediate data structures. For example, if
later in the code, you did this:
if ( exists $a->{b}->{c} ) {
burn the data center down
}
Then, BEFORE the change, that deep key didn't exist. AFTER the
change, it did. And that meant we had to rewrite the code as
follows, to effectively port it:
if ( exists $a->{b} and exists $a->{b}->{c} )
Although, I don't recall if "and" had been added by that time, either.
While I lack context on this particular issue, I merely ask that
however you solve it, please keep backwards compatibility in mind.
Phil (who is now going to spend the rest of the evening fondly
remembering his days contributing to perl5-porters.....)
On Tue, Jan 10, 2012 at 4:44 PM, Kurt Starsinic <kstarsinic@gmail.com> wrote:
> I'm looping in Phil Moore, as I recall that autovivification is an
> issue he has (or at least once had) rather vehement views on.
>
> Phil, my apologies in advance if you no longer care.
>
> - Kurt
>
> On Sun, Jan 8, 2012 at 7:39 PM, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
>> * Father Chrysostomos via RT <perlbug-followup@perl.org> [2012-01-06 20:35]:
>>> We need to come up with a concept that works (e.g., autovivification
>>> is a type of lvalue context, so only an outer lvalue context,
>>> propagated down to the rv2hv in question, will cause it) before we do
>>> much else.
>>
>> That sounds good to me. Off the bat I can’t think of a case where I want
>> autovivification for lower levels when I’m not mutating the last level,
>> so I can conceive of this as the default and mandatory behaviour.
>>
>> Maybe Abigail can think of such a case, though.
>>
>> Regards,
>> --
>> Aristotle Pagaltzis // <http://plasmasturm.org/>
Thread Previous
|
Thread Next