-
-
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
future room for pragmas: ignore %foo
syntax?
#12492
Comments
%foo
syntax%foo
syntax?
This could cause a lot of confusion since certain other languages use |
Counter example: julia> b = 5 ; foo = 2
2
julia> a = (b
%foo
)
1 |
That's a pretty pathological case that I'm willing to ignore as vanishingly unlikely to occur in real code. |
Having a user-extensible list of ignored words / patterns seems reasonable. |
I suppose I just instinctively dislike anything that is ambiguous, even if it is unlikely to occur in real code. |
Syntax aside, what would pragmas be used for? I wonder if pragmas could tell the compiler to do more aggressive optimisations - or less depending on your needs. |
This all looks like trying to find a syntax that can be parsed (even with the std. parser) but not executed/evaluated (i might be wrong here). But why not turning this around: having a function defined in Base (or Meta) that just creates no code - maybe a return statement only. but is valid in the preprocessing step/stage. Meta.pragma(:compileflags,'do it') |
@lobingera, that's a good idea – this doesn't have to be syntactic, it just needs to be a hook that is ignored unless used in a version that understands it. It doesn't really belong in |
i just choose Meta, because it's imported by default and somehow has something to do with code generation. |
In light of #12475, we may want to consider ignoring this syntax, which is currently an error (and seems unlikely to ever be wanted for anything else):
We would probably want to just to ignore any line matching
r"^\s*%\s*\S"
. Deciding what if anything such lines should ever mean, can be left for the future, but this leaves the option open to have some kind of backwards-compatible pragma system, in case we find ourselves in situations where tricks like #12491 aren't possible. See also #7449, which proposed a specific meaning for%if
, etc.The text was updated successfully, but these errors were encountered: