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 use of functional cookies. For more information read this page.

Personal Blog

ZPE is very flexible and powerful now. But there are still things that I've wanted to add since I started developing it. The compiler is very flexible and it's so easy to add new features that whenever one pops into my head I want to implement it. But sometimes a feature itself become complicated or changes the way the system works currently and I try to find a more standard approach to its implementation.

Two features I speak of are named parameters and infinite parameters. 

First, let's look at infinite parameters. Infinite parameters have been on the cards for a long time and actually existed for a short period of time in ZPE 1.5.x but were simply removed due to complications the features brought. In theory, they should be easy to implement because the syntax for them was something like:

$x, $y ..

On the compiler side, this is easy to implement. But on the runtime side, I wasn't sure how to represent it. Should $y be a ZPEList type? ZPEList would make sense so that $y[0] would be the first variable and $y[1] the second and so on and so forth. Infinite parameters are actually supported by internal native methods by default, but not by defined functions or external native methods added by plugins. This is why I feel this is a priority feature.

The other is named arguments. This is something implemented in ZPE 1.3.x for a period then removed before release. It's coming soon to ZPE (probably late this year) and it's one of my favourite up and coming features that will be released this year. 

Named arguments allow arguments to be specified in an out of order manner by specifying the name. This is roughly how it will look:

YASS
function makeperson($name, $age, $favourite_colour)
  print("Your name is " & $name & " you are " & $age & " and your favourite colour is " & $favourite_colour)
end function 
function main($args)
  makeperson (age = 10, name = "Jack", favourite_colour = "Purple") 
end function

Notice that the arguments are out of order and specified by their name. This is the main benefit of this new feature.