Other variable

In di.zep code

public function __construct()
{
    var defaultDi;

    let defaultDi = self::_default;
    if !defaultDi {
        let self::_default = this;
    }
}

why not just like this?

public function __construct()
{
    if ! self::_default {
        let self::_default = this;
    }
}

Why must use other variable?

This trik for prevent memory leak in zephir? https://github.com/phalcon/zephir/issues/825

Hi, There is a special forum for zephir: http://forum.zephir-lang.com/

However, im try the same code in my local zephir and works. maybe you try install the zephir last version.

im try with this code:

class Test
{
        public static _default;
        public function __construct()
        {
                if !self::_default {
                        let self::_default = this;
                }
                var_dump(self::_default);
        }
}


331

I know that the code works. I'm just curious why Phalcon still use other variables.

var defaultDi;

Maybe for prevent memory leak or something?

The first example is Phalcon code in di.zep file. That's why I asked here.

---- sorry about my english,,,

Really zephir translate its code to C as extension for ZendApi, is a translate, you can see in the folder ext from zephir project all code generated for Zephir, zephir then must convert the dynamic code in low-level code, zephir must convert dynamic var to static var, this is achieved with ""var"" php native so does, with $var, in low-level this done with zval struct in C language... look here http://php.net/manual/en/internals2.variables.intro.php