Skip to content

Conversation

@mlechu
Copy link
Member

@mlechu mlechu commented Oct 29, 2025

A small tweak to the macro added in #107 to unbreak stdlibs. Looks a bit strange, but life is good when there's only one sensible way of doing it.

Copy link
Member

@c42f c42f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it worrying that the @eval implementation itself needs to know about expr_compat_mode here.

I think it's ok to make @eval somewhat special as a stopgap but users may define their own @eval-like macros which makes it tricky to deal with the general problem. It seems that "should a quoted expression be an Expr or SyntaxTree?" isn't straightforward in general.

let T = :foo
@eval @doc $"This is a $T" $T = 1
end
"""; expr_compat_mode=true) === 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear what this is testing - can we be more precise here? And hopefully avoid Base.@doc in a unit test - it's very complicated 😅

Is the point that the type of @eval(quote x end) should be Expr when expr_compat_mode==true and SyntaxTree otherwise?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is complicated, but we have no integration tests yet and I'd like to prevent @doc from biting me again in the stdlib war (this case is reduced from LibGit2/repository.jl). I can add a simpler test above it though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good 👍

@mlechu mlechu merged commit cdeefb7 into main Nov 8, 2025
1 check passed
@mlechu mlechu deleted the ec/eval-st-compat branch November 8, 2025 03:53
adienes pushed a commit to adienes/julia that referenced this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants