Skip to content

Make is alias imply is ro. #79

@schwern

Description

@schwern

Read-only aliases are a great way to save memory and if you accidentally try to modify the variable Perl will spit at you.

Read-write aliases have far more limited use cases, either you can't be arsed to pass in a reference or you're doing something magical. If you accidentally use a read-write alias Perl won't tell you.

Read-write is the default for aliased variables. Whoops.

is alias should imply is ro, same way is copy implies is rw. If the user wants a modifiable alias they should have to explicitly declare it so, or consider using a copy or pass by reference.

This would break backwards compatibility, but I wonder how much code it would actually break, and how many accidental modifications of aliases it would reveal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions