Michael Lazzaro:
# Brent Dax wrote:
# > 
# > 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:
# 
# I imagine (if there are no objections) that the general 
# perldoc 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.

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 argue that one both ways.  Perhaps (thinking
# aloud) they only autovivify if you've explicitly called out 
# the exact type they store, but otherwise generate an 
# exception?  (Because it seems like the behavior would be 
# _very_ handy if you wanted it, and a real pain in the $#@ 
# when you invoked it unintentionally.)
# 
# So maybe if you previously declared them like this:
# 
#    my \Array %anagrams;
#    my \Array $undefined_var;

I think that, if Perl can determine the type with virtually no
ambiguity, it should autovivify.  In this case, since we know they
wanted an array (they used the @ explicitly), we'll autovivify an array.
(I say "virtually no" because one could make the argument that you don't
know if we wanted a standard array or a typed one.)

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
    --Albert Einstein (explaining radio)

Reply via email to