To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the user of functional cookies. For more information read this page.

TYPO is here!

24 Sep 2018 at 20:09
ZPE 1.6.7 finally adds TYPO!

TYPO is finally here in version 1.6.7 of ZPE. To be specific, TYPO has been in ZPE for a while but it's not been in use. Now ZPE is fully in support of TYPO. Take a look:

Variables can be declared (lines 8, 14, 17) using a type and then assigned with another value of that type (lines 11, 20). If you want to reuse the variable with a different type in it, you need to redeclare the variable (line 14). On top of that compilation errors are now thrown when a different type is assigned to a variable. Also, as seen on line 24, TYPO can evaluate internal methods for the return type and compare it to the type of the variable, hence why it will stop compiling at line 24.

This adds a bit more time to compilation, but helps in several ways:

  • From a learning/teaching perspective, TYPO encourages use of typing in programming
  • From a programmers view this is a good way to ensure that you are sticking to principles of programming

TYPO is by default turned off in all versions of ZPE but you can turn it on by changing the settings of the compiler. I recommend trying it out but do not suggest all programs written use typing! ZPE is primarily an untyped language and will likely always remain this way!