On Wed, Mar 11, 2015 at 6:10 PM, Rowan Collins <rowan.coll...@gmail.com> wrote:
> On 11/03/2015 23:21, Johannes Ott wrote:
>>
>> So now I want to do my first own proposal for a new function in PHP and
>> I hope doing it right with starting a discussion here first.
>>
>> The purpose of this suggestion is to introduce a static constructor,
>> which is called before the first call to class either static or
>> non-static to initialize some static properties which are needed by the
>> class.
>
>
> Can you give an example use case for when this would be useful? I'm
> struggling to think of one for which there isn't already an established
> coding pattern...

Notably, user-land enums. You don't want public constructors because
you don't want it instantiated except for each enum property. You also
need it to run on class creation, not afterwards.

I think we'd be better off adding language-level enums than static
constructors though.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to