Skip to content

isdefwith quote seems giving incorrect result #204

@mmikhasenko

Description

@mmikhasenko

I need to convert a mathematical function in a string into Julia lambda function.
Just found the package, it seems very useful.

Just stumbled by a very basic example: expr = :(x -> x + 2) is recognized as a function by isdef, while quote x -> x + 2 end is not recognized.

MWE

julia> expr = quote
    x -> x + 2
end

julia> MacroTools.isdef(expr)
false

julia> eval(expr)(3)
5

julia v1.10
MacroTools v0.5.13

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