katsaii / catspeak-lang

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

Toggle for Struct Hash over Struct Accessor #90

Open tabularelf opened 1 year ago

tabularelf commented 1 year ago

What is your feature request?

Catspeak uses struct accessors mainly because LTS does not support it. But as someone whose making their game in Monthly, I'd love to be able to use them. The only issue is that, there's no way of changing that behaviour at all without diving deep into the code and swapping out a bunch of get/set access calls.

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

If #89 gets added, this could be directly exposed as a feature flag, allowing variable hashes to be toggled on or off. This means that while LTS may not be able to use it, for those who aren't on LTS, they can enable it for themselves to gain a free performance boost.

The idea for the most part replaces the __catspeak_expr_*_set/get__ functions with two versions. One that's the same behaviour as it is now, and one that's for hashs. If the feature flag has it off, hashes will be -1 (or non-existent for saving memory)