ZPE 1.12.7 brought many of the biggest updates to ZPE in a long time including bundling a YASS-based standard library that is compiled on start up, changing the way imports work and breakpoints.
Now ZPE 1.12.8 is just about ready for launch and it brings many big new features and changes.
The new features of ZPE 1.12.8 are:
- Namespaces have finally been added to ZPE
- Much better error handling
- The new -h bytes will list all byte codes available in ZPE and their representation, great for development
- New Javadoc based documentation is being added, a considerable amount has already been added to ZPE 1.12.8.
- Return types on functions can now be stated with
->
as well as:
- Several new exceptions have been added to ZPE (this version is known as the 'exception version' as a result)
- Short anonymous functions () => {} now support typed parameters.
- Static functions and static function calls are now available too (they will soon support namespaces too)
The big changes in ZPE 1.12.8 are:
- The cache values file is now stored in the ZPE folder, rather than where ZPE is executed. It makes much more sense this way.
- ZPE introduced a new ZPERandomizer engine in July
- Log files have been changed so they no longer take up too much space on disk and they rotate more efficiently
- ZPE Online files are now compiled when they download to ZPE
- The JSON parser now supports the null value
- Regexps have been improved to reduce the time they require to compile and test
- The main introduction is more detailed than ever before, making it easier to find out about a ZAC than before
- std_out prints to the same line
match
statements now only support one else statement and it must be the last condition of the statement
There have been several bug fixes too:
- ZPE no longer keeps asking to install the standard library if you said no
- Shell return values are now ZPEStrings making them comply with the ZPE data type list
- The --man option stated that all functions return an object on all instances due to a bug, this has been fixed.
- The rate and voice parameters in the speak command were not optional and this has now been fixed (as has the manual heading)
There are two breaking changes which include the new syntax of the match statement has now changed and the copyof keyword has been dropped. Both of these lead to YASS 24.7. Make sure you read the changelog to understand what it is that has changed.
Namespaces are finally here with ZPE 1.12.8! They are essential for organising libraries and structures throughout programs. Look at the code below to see how they work:
structure HTMLBuilder namespace jsmith/packages /* * Functions go here * ... */ end structure $builder = new jsmith/packages/HTMLBuilder()
I usually come up with codenames for the next version of ZPE quite far in advance, and this year is no exception.
For version 1.13, the following codenames have been decided:
- Petergate
- Micklegate
- Davygate
- Castlegate
- Monkgate
- Goodramgate
- Fossgate
- Colliergate
- Gillygate
- Walmgate
- Coppergate
- Stonegate
The inspiration for these codenames came from the City of York, where I recently had a short break.
ZPE 1.12.7 is now available to download. This version brings sweeping changes to the way that libraries are imported into YASS code and the ZRE; it introduces bubbling, brings breakpoints to ZPE, fixes an issue with permission levels not being read correctly, and, perhaps most importantly, adds unescaped string literals to the YASS language.
All of these features makes ZPE 1.12.7 one of the most jam-packed releases of ZPE to date.
Here is a program for a linear search I wrote in YASS some few months ago.
function linearSearch($item_list, $search_item) : number | boolean { $found = false $index = 0 $position = -1 while ($index < count($item_list) and $found == false){ if ($item_list[$index] == $search_item){ $found = true $position = $index } $index++ } if($found){ print("Item found at position", $position) } else{ print("Item not found") } } function main(){ $l = [3, 5, 7] linearSearch($l, 6) }
And here it is converted to Python using ZenPy:
def linearSearch(item_list, search_item): found = False index = 0 position = -1 while index < len(item_list) and found == False: if item_list[index] == search_item: found = True position = index index += 1 if found: print("Item found at position", position) else: print("Item not found") def main(): l = [3, 5, 7] linearSearch(l, 5) main()
I have been seeking to add breakpoints to ZPE for the last seven years, and I have finally succeeded.
They work using the new bubbling technique I have developed. In ZPE, bubbles are exceptions; a breakpoint is a simple bubble. Bubbles go all the way to the top of the runtime and are handled by the parent. Complex bubbles work entirely differently, and although they are also bubbles, they can be handled by different parts of the program.
A breakpoint is added to YASS code by writing #breakpoint# where the code should break. In the GUI mode, it will display a variable watch window:
Another prominent feature brought to ZPE this year is bubbling. ZPE will introduce bubbling with version 1.12.7. It is used for interrupts such as exit requests, errors, and breakpoints. These are called bubbles since they are up to the program's top. So, for example, an exit request no longer exits ZPE; it handles a bubble instead to decide what to do with it (and, of course, that might be to exit, or it might be to close the active thread).
Bubbling is a huge feature that changes many of the underlying implementations of ZPE.
One of the significant updates coming to ZPE 1.12.7 is a major change to how ZPE handles library imports. This post is designed to outline this change so I can reference it from the changelog and GitHub commit.
Before this version, ZPE would read in library imports from a yex file in the libraries folder. This hasn't changed. The library files themselves need not be recompiled. However, the way they are imported has changed. In the older version of ZPE, a library was imported as a variable with all the structures and classes being defined within them:
import stdLib
print($stdLib->bubble_sort([2, 7, 1, 6]))
In ZPE 1.12.7, this changes. Now, instead of adding the bubble_sort
function to the $stdLib
object, the bubble_sort is put into the top level of the runtime (i.e. added to the global function), so instead you would call bubble_sort
:
import stdLib
print(bubble_sort([2, 7, 1, 6]))
ZPE 1.12.7 also allows doing this in the old manner by using the new import as syntax:
import stdLib as stdLib
lib = new stdLib()
print(lib->bubble_sort([2, 7, 1, 6]))
This new change will make some difference to the way in which libraries are used and will improve ZPE performance and memory footprints.
I recently started working on the YASS to Python transcompiler. It's worked well over the last few weeks, and I've decided it needs a proper name.
Without further ado, let me introduce ZenPy.
ZPETypes were first introduced to ZPE a few years back when the move to 'everything as a function or object' concept evolved. This paradigm shift made it impossible for ZPE to encounter data types such as BufferedImages as it had previously, restricting such data only to ZPE structures (and, indeed, ZPEObject instances). This tidied up the core of ZPE, improved performance, and caused fewer crashes.
Now, I embark upon perhaps the most exciting yet ambitious project in ZPE's history: shifting away from generic values to ZPETypes for all return values. This is not going to be a quick job either, and it could take several days of development. But it's necessary to make ZPE feel more solid and improve performance even further.
ZPE is close to its 100,000th download as of this year, so it is time for this change to come around. I seek to have it done by the end of the summer.