ZPE 1.13.5, released in April 2025 introduced modules to ZPE. These powerful constructs are pathing the way to more useful libraries for ZPE.
Libraries are static methods and values. They may contain immutable variables (once defined may not be modified), any number of functions and structures. They cannot contain tuples or records.
Accessing constants, functions and structures of a module is done using the scope resolution
operator (::
), e.g.:
YASS
jamieb::whoami()
The code below demostrates defining modules and using the scope resolution operator.
YASS
function test() print("Hello") //This should not do anything as fullname is defined in the module print(fullname) jamieb::whoami() end function module jamieb fullname = "Jamie Balfour" //This function will load as main function, but it will not be a part of this module as main functions are run statically function main() //This is an ordinary function being called from the module test() //Although the fullname variable is defined in the module, the main function is called statically print(jamieb::fullname) jamieb::whoami() end function function whoami() print("My name is " & fullname) end function end module
Comments