Hi guys.
For a 2 years, I have scripting in Roblox, without use of --!strict, --!native and other similar things. But now I have started to wonder, if this somehow affects scripts. Especially --!strict, because it warns my entire scripts which work fine for me.
Should I learn how to use it, rescript all my scripts to follow --!strict, or it doesn’t really matter?
The type checking engine is too much of a pain to work with, in --!strict mode. Some (valid but more uncommon) coding patterns literally don’t work with --!strict (can’t get rid of the warnings), so I mostly use --!nonstrict for autocomplete purposes
As for --!native, and performance benefits from using types, types currently only improve performance for native code (if the types cannot be inferred), but doesn’t improved performance for interpreted code (non native code) yet (or I haven’t seen any update about it)
You can read more about --!native and performance improvements from types with --!native here
Most warnings you can get rid off but you just have to do a little more. Me personally, I use strict mode on modules all the time because strict mode allows me to make less errors. Why do I use it on modules all the time? Well, because many important scripts use the modules and an error occurs it would literally break everything lol
I personally don’t really care about catching more errors as the errors caught by using type checking are usually errors that are obvious and very quick to find and fix (such as using ipairs instead of pairs)
I also tend to have modules and code that is fairly “linear”, so I rarely encounter errors that happen only in specific situations
However, the autocomplete it provides is a game changer for me, all the modules I make, I make sure that the functions and methods have proper autocomplete which saves quite a lot of time when using it afterwards, and makes it clearer to other people using it as well
strict gives no performance or behavioral difference, and is only for the purpose of having a more thorough type checking system (better autocomplete).
should only ever really use it if you’re sharing a module or some form of resource that others will use code from.
now --!native does impact performance, it can seriously improve it as it skips the interpreter and instead is translated directly to C++
(though its useless for code that is only executed once, and i believe it only applies for functions)