Skip to content

Conversation

technomancy
Copy link
Contributor

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.

@nesbox
Copy link
Owner

nesbox commented Feb 22, 2023

I think the the risk of breakage is relatively low, pls enable strict mode with multiple spaces.
Thank you.

This makes it so that unknown globals need to use the _G table; this
feature was originally added in 82b0536.

It was broken in 6171e0d when a spurious space was added to the
headers. Technically this is a breaking change, but hopefully it won't
affect too many carts.
@technomancy
Copy link
Contributor Author

OK, sounds good. I've made the change as described. Thanks!

@nesbox nesbox merged commit 19b6456 into nesbox:main Feb 23, 2023
@technomancy technomancy deleted the fix-fennel-strict branch April 14, 2023 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants