-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
scope of identifier names in lowered syntax forms #25947
Comments
Good catch. Reviewing all such cases (where syntax is transformed to call a function with a name not evident in the code), we're not consistent about this. I think we should change them all to be hygienic; i.e. call |
Another point specific to this example: we could make |
This is now fixed for #26273 has an interesting related example. The macro in question contains basically
There is some good discussion of this in #25957. Our options are basically (1) make these lexically scoped with hygiene support using names like
Items marked (*) are currently lexically scoped (except for the hygiene bug). Then some borderline cases: generators: iteration: indexing: These are all of the cases where a syntax form corresponds to a function call, but the function name is not evident in the source code. |
I have this funny feeling that Cassette is going to turn out to be the way to do this, but I feel like we may as well do option (1) and allow people to play with this. But I also don't think it's a high priority. |
Cassette seems a bit excessive when a simple lexically-scoped identifier would do. Also, this is not for transforming other people's code, just writing your own code using a custom definition of |
At this point I'm leaning towards making them all call |
It changes the lowered code though, doesn't it? Not saying we can't do that, but we should record it as a caveat and give tips on how to write future-proof code in the Julia API stability doc I've been keeping. |
Do you have anything in mind that that would break, other than code calling |
Is this behavior intended?
If so, is it documented anywhere what variable/function names could change behavior, or could the names used by changed to be more "internal-looking" (e.g.
__colon__
instead)?I can see how the behavior is a potentially useful feature:
The text was updated successfully, but these errors were encountered: