Repository navigation
Activate strict mode in Fennel when strict: true header is found. - #1653
Conversation
Global mode makes it so that it is a compile error to refer to a
global which doesn't exist yet. Using (global foo {}) will declare foo
as a global which can be used after the declaration, or you can always
bypass the checks using _G.foo.
This will catch a lot of errors earlier on during the compilation
process instead of at runtime. This should have been on by default
from the start. But better late than never. =)
We change the demo Fennel cart to add the strict header by default for
new games, but it's easy to delete for users who want the more
Lua-like global behavior.
|
I changed Is this just a flaw in the build process that the old version of the cart has stuck around, or did I miss a file I need to change to update it? |
|
Btw, just tried this card https://tic80.com/play?cart=2302 with your changes and got Any chance you add backward compatibility with old carts? |
|
Thanks! I believe the problem you're seeing is not caused by this change but by the previous one; we fixed a bug, but this code was relying on that bug. I know the author of that cart so I sent them a fix here: peterhil/alchemy#5 This PR should not have any adverse effects because it only triggers when the However, we are about to release Fennel 1.0.0 which has a few breaking changes in it intentionally. (Hopefully the last breaking changes ever.) Nothing big; similar to the change from Lua 5.3 -> 5.4. But I'm not sure how to address this problem. I have a list of all the Fennel games I know about and have been testing them manually here: https://git.sr.ht/~technomancy/fennel-compendium (I actually found the problem you mentioned a few days ago but I only mentioned it to the author on IRC instead of opening a PR.) So if the number of Fennel carts is small maybe that's enough; we can just manually reach out to the authors. It won't scale indefinitely, but then again, we don't plan on making any backwards-incompatible changes after 1.0.0 either, so maybe it's OK. Do you know of any other Fennel TIC-80 carts which aren't listed? https://git.sr.ht/~technomancy/fennel-compendium/tree/main/item/Makefile#L100 |
Strict mode makes it so that it is a compile error to refer to a
global which doesn't exist yet. Using (global foo {}) will declare foo
as a global which can be used after the declaration, or you can always
bypass the checks using _G.foo.
This will catch a lot of errors earlier on during the compilation
process instead of at runtime. This should have been on by default
from the start. But better late than never. =)
We change the demo Fennel cart to add the strict header by default for
new games, but it's easy to delete for users who want the more
Lua-like global behavior.