Handle function and macro expressions in explore#38
Open
satkarjuneja wants to merge 2 commits into
Open
Conversation
Member
|
Nice, thank you for your PR! Could you also add a new test case for this? If this syntax was added in a later Julia release, you can use Meta.parse like in some other test cases. |
Author
Done |
|
Thanks for having a look! Nice that you also cover macros. Have you checked whether other keywords that create variable bindings should work with the local prefix too? Struct, mutable struct, module, baremodule comes to mind. |
Author
It seems julia itself wont allow local structs |
fonsp
approved these changes
Jul 7, 2026
Member
|
Okay! In that case this PR is ready in its current form, right? |
Author
|
Any issues @fonsp ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an attempt to fix JuliaPluto/Pluto.jl#3545
The problem seems to be with the
explore_local!function insrc/explore.jlin the function there was no handling to detect
local functionor macrothis condition seems to fix said issue
I have ran the test suite it seems to work
the reason for
old = scopestate.inglobalscopeis thatScopeStateis declared as a mutable struct , the function receives a reference to the same object. So when explore_local! does scopestate.inglobalscope = false, it isn't creating some local, function-scoped version of that field. It's reaching into the one shared object and changing a field on it, visible to everyone else holding a reference to that same object.So it should be set back after the inside of the function is explored