Type Safety
ChunkScript is super type safe. This prevents bugs, and saves engineering time during refactors. ChunkScript does not support type inference. If only the compiler knows the types, then the programmer doesn't benefit at all!
Instead of type inference, ChunkScript has type-interrogation. If you attempt to compile the following:
you will receive the following error:
ChunkScript is telling us to be clear at the point of use what type myDog
is. We can amend the code to remind future programmers what type it is using the whichIsA
operator, and stop the error:
You don't always have to do this. ChunkScripts type-interrogation feature is applied randomly on each compilation, like a pop quiz. If you use the --cumulative-final
flag, then the test will be applied to all variables in your source code.