Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Make nested function definitions lexical by default #383

Open
@rurban

Description

@rurban
sub makeAddr($x) {
    sub adder($y) {
        return $x + $y
    }
    \&adder
}

as if declared as my sub adder, adder is not added to the global namespace. But if the function is declared within eval string it is global, even when in another function block.
You can also declare it as our sub adder to extend the scope to the current package, to be found with the method dispatch. The CV itself is stored in the lexical pad of makeAddr though still.

See also http://www.erights.org/elib/capability/ode/ode-objects.html

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