katsaii / catspeak-lang

A cross-platform modding language for GameMaker games.
https://www.katsaii.com/catspeak-lang/
MIT License
81 stars 4 forks source link

Feature Flags (Compiler flags) #89

Open tabularelf opened 9 months ago

tabularelf commented 9 months ago

What is your feature request?

Currently there's a few specific features in Catspeak that could be altered or changed, but without any direct way of controlling that, it's hard to do. Whether it'd be for more speed reasons or for disabling or enabling specific logic within Catspeak. With this feature request, featureFlags would be exposed to the interface, allowing users to flip on/off specific features and logic before compiling their code.

Please describe in detail how you expect this new feature to behave.

Take for example with variable access. Catspeak currently does everything via struct accessors, that's mainly because the struct hash functions aren't in LTS. But as someone who doesn't use LTS, I'd love to use those instead. Especially because they're a lot faster. So if we had something like this

Catspeak.interface.featureFlags.useVariableHash(true);

Then Catspeaks codegen will instead switch over to using struct hash versions, speeding variable access immensely.