-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Implement __SCOPE__ #776
Implement __SCOPE__ #776
Conversation
|
As I said, I don't like this functionality because I think it caters to too specific a purpose, which natively handling in RGBASM brings little benefit. (Paging @AntonioND to have a third opinion) Plus, erroring out when no scope is present means there's no way to handle that case, it should rather not be defined then, as the documentation suggests ("undefined"). |
When no scope is present, (Edit: The " |
Then what is this check for? (I didn't look further after seeing it, assuming it was the only one; hence my inaccurate reply)
I don't like that it's hardcoded, tbh. |
The checks I agree that hardcoding the |
No memory issues at all, since the buffer returned is global. Removing and re-inserting the symbol manually into the hash table would be more problematic (repeated allocations and de-allocations), and it would still be hardcoding, which I really really want to avoid. Call it PTSD perhaps. |
The repeated allocations and de-allocations are what I meant by memory issues. To technically avoid hardcoding a |
The implications of the latter on the rest of the codebase's assumptions are not something I would want to deal with, certainly not in 0.5.0. |
Actually, another solution would be to act like |
The difference, again imo, is that PC is a necessary evil, but that this functionality isn't worth all that trouble. |
Okay. For now I've updated this to use a Any idea why the |
Not the slightest. |
Not really. This can be used by all sorts of metaprograming, ranging from good error messages to structure-defining macros. See: |
Structure-defining macros exist of all sorts, and never needed this (nor has it been bothering); and what error messages are bad? |
|
There's never been a need for this, and it's incompatible with a variety of uses, which is why I'm deeming it as "not enough". |
That would be:
|
This would only be beneficial if there were more than a screenful of lines between the last global label (assuming none of the macros in the middle define one) and the erroring macro. Frankly, it's more fragile than anything. |
In that case the |
You're assuming that people know how to read error messages. A week in pret's #pokecrystal will quickly prove you wrong. |
Nothing can be done for people who don't want to read error messages. |
I'll go ahead and close this, but am still interested what @AntonioND thinks of the feature and of this implementation approach. |
So I'm a bit confused, what's the purpose of this apart from having custom error messages? |
@ISSOtm Is the update without a hardcoded check in |
398d18a
to
cb73096
Compare
3d6fb6e
to
916a397
Compare
da556b4
to
ed9d012
Compare
I agree that many of RGBASM's features are not strictly necessary, but are convenient and improve the code quality significantly. The key part is "significantly": balancing the benefits gained with the increased complexity (both in maintaining and, possibly, performance); and it's largely subjective. You're welcome to disagree, but I don't think this change is useful enough to warrant native syntax/support. Further, it severely limits future expansions to scoping (which would be very useful), and I'm afraid about its interactions with other features. (Think #342, for example.) tl;dr: I don't like this feature as-is, so I'm going to put it on the backburner for now, and will look at it after more important features have been dealt with. (See what's attached to the 0.5.1 milestone, basically.) |
c6d64a4
to
d35b775
Compare
b1c4780
to
2781bfd
Compare
__SCOPE__ expands to the currently scoped label. It is empty if inside the main scope. Fixes gbdev#775
As long as |
I'm considering more complex scoping like ca65's |
(For |
__SCOPE__
expands to the currently scoped label. It is empty if inside the main scope.Fixes #775