Fix strict mode in default fennel cart. #2136
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 6171e0d a bug was introduced which disabled strict mode for newly-created Fennel carts, because strict mode is activated by the presence of ";; strict: true" in the cart's headers, but that commit broke it by adding an extra space after the colon.
See https://github.com/nesbox/TIC-80/blob/main/src/api/fennel.c#L41
If we could ignore backwards-compatibility, it would be better to fix the check so it would be tolerant of spaces.
However, since this bug was introduced before the release of 1.0.2164, carts may have been created using the stable release that have the extra spaces in the header but are not actually compatible with strict mode. So fixing the strict mode check would cause those carts to no longer be playable.
Rather than breaking backwards compatibility it's probably better to just fix the
new fennel
text to include the strict mode header with one space, so that at least new games can benefit from it.However, if you think the risk of breakage is relatively low, I can change this so that the strict check will trigger even if there are multiple spaces. Strict mode is meant to catch typos by making it so that globals have to be referred to using _G; without strict mode, Fennel mimics the more runtime-error-prone behavior of Lua.