-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added @softscope macro for ease of use #1
Conversation
LGTM, once the merge conflict is fixed. |
Great, I'll have a look at it tomorrow. (I might switch around how the escaping is handled since I'm not quite happy with it.) |
src/SoftGlobalScope.jl
Outdated
``` | ||
""" | ||
macro softscope(ast) | ||
esc(softscope(__module__, ast)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't __module__
new in Julia 0.7 (JuliaLang/julia#22064)? SoftScope.jl has to support 0.6, where I guess you would use current_module()
.
Needs a test. |
Working on it; consider this a WIP for the moment. |
OK, all done. Should be v0.6+ compatible and has tests. |
Sorry to invade this PR, but I think it is better to ask here than to open a new issue.
i.e. the |
Hi @Datseris, see #2 for that request. I looked into it further this afternoon and I have a few suggestions for a way forward (I'll write up in the next few days). In the meantime, I've updated the gist at https://gist.github.com/dawbarton/0388715fb56fb5cd05e0e4b12c322815 which implements my first attempt at the REPL hooks. Note the comment in the code if you use Revise! (Don't try putting the code in your |
I modified the test to make sure it works with a variable that is defined in the |
Two can play at that game! 😄 Try this with
I think we'll need to recurse into blocks and record new assignments rather than just trying to execute one block at a time (which will obviously fail here). I've got a stack of exam marking to do by close of play tomorrow so I won't be able to have a look before then but I'll have a go at it after that if you haven't already had a look at it. |
@dawbarton, yes, that occurred to me. It's not high on my priority list at the moment since I'm guessing that defining new global variables in blocks is not so common in interactive code, but we can definitely catch some common cases like However, without that feature I suspect that (It will be possible to fool |
This should now all work correctly with #4 merged. |
The title says it all really. Thanks for making this package.