FluxML / FluxML/MacroTools.jl

`isdef`with `quote` seems giving incorrect result

Open
#204 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
320
Forks
84
PR merge metrics
No merged PRs in 30d

Description

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
julia> expr = quote
x -> x + 2
end

julia> MacroTools.isdef(expr)
false

julia> eval(expr)(3)
5
```

julia v1.10
MacroTools v0.5.13

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the MWE with Julia 1.10 and inspect MacroTools.isdef on both the direct lambda expression and the quote-wrapped expression. Compare the two expression shapes and add regression coverage so the intended isdef result for the quoted lambda is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
compilers, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.