Skip to content

eval doesn't have access to variables in function scope #2386

@stevengj

Description

@stevengj

The following works:

julia> x = 3;
julia> eval(:x)
3

But this gives an error:

julia> bar(y) = eval(:y)
julia> bar(7)
ERROR: y not defined
 in bar at none:1

It makes no sense to me that eval does not evaluate its expressions in the scope where it is called (and the manual seems to indicate this as well).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions