Skip to content

Align :method Expr return value between interpreter and codegen #58076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2025

Conversation

Keno
Copy link
Member

@Keno Keno commented Apr 11, 2025

Interpreter/inference think the 3-argument :method Expr returns nothing. Codegen thinks it returns the new method. I think the latter makes more sense, because it lets us write explicit syntax-level dependency links between method definitions and constants (used e.g. for external abstract interpreters), which is something that Revise may need in the future. Adjust the interpreter/inference to properly return the method.

Interpreter/inference think the 3-argument `:method` Expr returns `nothing`.
Codegen thinks it returns the new method. I think the latter makes more
sense, because it lets us write explicit syntax-level dependency links
between method definitions and constants (used e.g. for external abstract
interpreters), which is something that Revise may need in the future.
Adjust the interpreter/inference to properly return the method.
@Keno Keno requested a review from JeffBezanson April 11, 2025 01:33
@Keno
Copy link
Member Author

Keno commented Apr 11, 2025

I played with this a bit more and it's actually very hard to get at the return value of that method object. @overlay used to return it before the latestworld changes (but not in the interpreter of course). I decided to restore that functionality and test it so that @overlay always returns the newly added method.

@Keno
Copy link
Member Author

Keno commented Apr 11, 2025

Per discussion with @JeffBezanson - this change is fine, but should insert explicit (null) for the non-overlay case.

@Keno Keno force-pushed the kf/methodretmethod branch from b986db7 to d448a7a Compare April 12, 2025 04:13
@Keno Keno merged commit 1570bed into master Apr 13, 2025
5 of 7 checks passed
@Keno Keno deleted the kf/methodretmethod branch April 13, 2025 03:28
serenity4 added a commit to serenity4/JuliaInterpreter.jl that referenced this pull request Apr 15, 2025
aviatesk added a commit to JuliaDebug/JuliaInterpreter.jl that referenced this pull request Apr 21, 2025
* Support evaluation of overlayed methods

* Add comment

* Bump version

* Support more expression types defining the external method table

* Attempt a few fixes

* Fix 1.12/nightly failures that were present before this PR

* Adjust to JuliaLang/julia#58076

* `jl_method_def` actually returned a `Method` already

* Export `extract_method_table`, add option to disallow `eval`

* Quickly try a nightly fix

* Remove unnecessary dependency on Tensors for testing

The test that used it doesn't actually need it to
test what was intended

* Wrap evaluation in try/catch

* Use isdefinedglobal

* Adjust broken test to have it throw consistently

Otherwise, it would fail at the first evaluation and
succeed on subsequent ones.

* Update comment

* Replace `Core.eval` with `getglobal`

* Update src/interpret.jl

Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>

---------

Co-authored-by: Cédric Belmant <cedric.belmant@juliahub.com>
Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
serenity4 pushed a commit to serenity4/julia that referenced this pull request May 1, 2025
…liaLang#58076)

Interpreter/inference think the 3-argument `:method` Expr returns
`nothing`. Codegen thinks it returns the new method. I think the latter
makes more sense, because it lets us write explicit syntax-level
dependency links between method definitions and constants (used e.g. for
external abstract interpreters), which is something that Revise may need
in the future. Adjust the interpreter/inference to properly return the
method.
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.

1 participant