Skip to content

[doc] Autovivification documentation in perlref.pod should be improved #21823

Open
@vinc17fr

Description

@vinc17fr

Where
perlref.pod, Section Arrow Notation.

Description
Autovivification is just described based on the example

$array[$x]->{"foo"}->[0] = "January";

with an explanation starting with

This is one of the cases we mentioned earlier in which references could spring into existence when in an lvalue context.

First, it is not clear what "lvalue context" means, in particular because autovivification also occurs with code like

defined $array[$x]->{"foo"}->[0];

Moreover, the documentation should also be clear that autovivification also occurs when it would not be necessary, because this fact is not obvious at all, and there have been many complaints about autovivification in such a case (see #11846), where autovivification can yield obscure bugs in scripts (in one of mine, where I was just doing tests with defined, it took me some time to find the cause).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions