-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
[Feature request] Raw #symbol
s would not go through EQUS
expansion
#1605
Comments
This is overloading an operator to have a completely different meaning; it's both confusing (why does this behave differently in this particular corner case?) and detrimental (no way to use raw symbols as raw symbols). All this to save three characters. Adding 20 different meanings to the same operator depending on finicky details about the context is unwarranted complexity — too much JavaScript in your life isn't good for you :) |
I thought the above already addressed those points, but:
|
ISSOtm approves <3 |
|
I'm still concerned about the slippery slope (hence my "20 different meanings" remark from above: I'm not expecting this to be the last weird case someone proposes). But if you strongly feel like this one in particular has that much value to add, and you have the data to show it, it might be worth the mental complexity. |
This is a step towards decrease in complexity. Previously: "How do I just use a string symbol directly, without it being EQUS-expanded?" With this PR: "How do I just use a string symbol directly, without it being EQUS-expanded?" In future: "How do I just use a string symbol directly, without it being EQUS-expanded?" Footnotes
|
Some non-exhaustive examples of how non-expanded raw string symbols should behave:
|
I would argue this change is in the spirit of the intended use case for raw symbols: suppressing implicit behaviour. Raw symbols were introduced because the same syntax is being used for both keywords and identifiers, so a codegen backend has to check the latter against a whitelist to ensure that the latter isn't actually the former. The way This was my rationale for approving this change when Sylvie asked. Maybe we will come to regret this later, but I think it's less likely that we'll regret this change than keeping the current behaviour. |
It's too early to even consider deprecating or removing
EQUS
expansion (#905) -- we don't yet have user-defined functions or other replacements forEQUS
use cases. However, they can still be inconvenient -- you have to do"{foo}"
to get the value of your string symbolfoo
.ASMotor has a shorter way of doing that,
|foo|
. However, I wouldn't want to add new syntax, whether as delimiters, a prefix, or a suffix, since we may eventually remove the feature anyway, and since it's not significantly simpler than typing"{
}"
.However, we already support the
#
prefix for raw symbols. That was introduced to allow symbols that share a name with keywords, which is a very niche application (most of the time you can just use non-clashing names).I'd like to make raw symbols not undergo
EQUS
expansion. Note that the syntax can be used on any symbol, not just ones that clash with keywords. So you could dodo #foo
instead ofdb "{foo}"
, which saves three characters and is IMO a worthwhile savings to read and to write.In theory this would break someone's code if they were currently doing something like
def #purge equs "rst PurgeMyCache"
and then#purge
as an instruction macro. But I think it's clear that nobody is doing such a thing. :PThe text was updated successfully, but these errors were encountered: