Skip to content
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 #symbols would not go through EQUS expansion #1605

Open
Rangi42 opened this issue Jan 9, 2025 · 2 comments
Open

[Feature request] Raw #symbols would not go through EQUS expansion #1605

Rangi42 opened this issue Jan 9, 2025 · 2 comments
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Milestone

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Jan 9, 2025

It's too early to even consider deprecating or removing EQUS expansion (#905) -- we don't yet have user-defined functions or other replacements for EQUS use cases. However, they can still be inconvenient -- you have to do "{foo}" to get the value of your string symbol foo.

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 do do #foo instead of db "{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. :P

@Rangi42 Rangi42 added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM labels Jan 9, 2025
@Rangi42 Rangi42 added this to the 0.9.1 milestone Jan 9, 2025
@aaaaaa123456789
Copy link
Member

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 :)

@Rangi42
Copy link
Contributor Author

Rangi42 commented Jan 10, 2025

I thought the above already addressed those points, but:

  • People aren't using raw symbols (unless they're generating SM83 for LLVM, which was the user case that got raw symbol syntax added.). People definitely aren't using raw symbol syntax for non-clashing symbols that don't need it. It's okay to overload the syntax for a fairly common use case; it won't be "confusing".
  • Did you read my last paragraph? "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." So your concern about this change being "detrimental" is not based in reality -- and if for some reason you do insist on having a string symbol named #purge, you can expand it explicitly by doing {#purge}.
  • You miscounted; this isn't 20 different meanings, it's two. (I know you're exaggerating. It's a habit of yours and I really don't like it, because I have to either deflate it or just address the actual reality or waste verbiage on both.)

@Rangi42 Rangi42 modified the milestones: 0.9.1, 0.9.2 Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Projects
None yet
Development

No branches or pull requests

2 participants