Re: New RFC draft "static class constructor"

From: Date: Mon, 13 Apr 2015 22:24:25 +0000
Subject: Re: New RFC draft "static class constructor"
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-85793@lists.php.net to get a copy of this message
On Mon, Apr 13, 2015 at 7:37 AM, Johannes Ott <mail@deroetzi.de> wrote: > Hi, > > finally I managed to do my first RFC draft. > > https://wiki.php.net/rfc/static_class_constructor > > I hope I have done everything correct so far and I'm looking forward to > your feedback on it. The static constructor cannot be called by the user, which means it shouldn't even register as a function. Additionally, it is always private. Given these constraints I would prefer to change this syntax: class Config { private static $arIni; private static function __static() { $self::$arIni = parse_ini_file('config.ini'); } } To this (borrowed from Java): class Config { private static $arIni; static { $self::$arIni = parse_ini_file('config.ini'); } } I do not see any reason to do the former unless the latter has conflicts in the parser, which I don't think it would.

« previous php.internals (#85793) next »