Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

By reference in ZPE

ZPE has very recently made objects a staple part of the language. But did you know that all variables within an object are actually references? What I mean is that if you change a variable (property) within an object in ZPE it will actually update the object.

YASS
$o = {$x : 10}
//Will print 10
print($o->$x)
$o->$x = 50
//Will print 50
print($o->$x)

So what does this mean and just how can it be brought further into ZPE? Well this exact concept will be used in ZPE 1.6.8 (December 2018) to bring forward by reference variables. These variables have sort of existed since some version 1.5.x but have found very little use. They work on a different system to ordinary variables however and a system of trust between the function itself returning what is necessary.

Whether or not ZPE 1.6.8 completely adds support for by reference or not is dependent on how much I manage to get done with regards to it, but I can say for a fact that it will be very useful as both a learning tool and as a feature of the language when it is done.

zpe
1.6.8
by
reference
Comments
Powered by DASH 2.0