rgbds
rgbds copied to clipboard
[Feature request] `ENDS`
At the beginning of a file, there's no current section. Putting any code or data there is an error.
Sometimes it's desirable to return to that state. For example, if a macro expansion creates a section, it might be desirable to explicitly close it. (Even though PUSHS/POPS can do that, there might be a good reason not to.) Likewise, if files are created by some tool by concatenation, it might be useful to add an explicit end marker, so that any garbage generated by the process (like a loose db) properly raises an error instead of being accidentally added to the end of a section.
Thus I'm asking for an ENDS keyword that closes the current section and goes back to that "no section" state. Note that I'm not asking for all sections to be explicitly terminated; it's perfectly fine and reasonable for a SECTION declaration to end the previous one. Rather, I'm asking for a way to end the current section without starting a new one.
When you enter a PUSHS context, it clears the current section, so you can use PUSHS like a "BEGINS" and then use POPS for ENDS.
I guess that helps a few of the use cases, but still leaves uncovered accidental additions at the end of the file, which are what moved me to make this request in the first place.
"ENDS" will probably be used for structs, and even "ENDSECTION" would be yet another keyword. "SECTION HALT" or "SECTION STOP" might be too hacky.
SECTION STOP is also a possibility :)
Yeah, but I'd rather not. PUSHS/POPS cover the current use cases well enough, and I don't see others ATM.