Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-15 Thread Máté Kocsis
Hi Rowan, I'm also on the opinion that making the mixed type the (implicit) default is not a good idea. However, I believe the uninitialized state is useful, what's more, it was unavoidable in order to properly support non-nullable object properties. But I don't want to make a case for this

Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-15 Thread Máté Kocsis
Hi Larry, I admit that this flag is not too interesting, but I believe it still has its own merit. I can imagine that the flag could play well with property accessors as well, however, in my opinion, the main use-case of final properties generally doesn't involve setters/set accessors. > In that

Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-15 Thread Larry Garfield
On Fri, Feb 14, 2020, at 7:22 AM, Máté Kocsis wrote: > Hi Internals, > > I'd like to propose the idea of adding support for immutable/final/readonly > properties in PHP 8. > > My plan is to add a new immutable/final/readonly (the name is up for > debate) property modifier to the language so that

Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-14 Thread Rowan Tommins
On 14/02/2020 13:42, Máté Kocsis wrote: Maybe only if our long-term goal would be to deprecate/remove non-typed properties and implicit initialization altogether in favour of mixed type and implicit uninitialization... Can I just leave an "ugh, please no" on this part. I remain of the

Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-14 Thread Máté Kocsis
> > If somebody really wants a `mixed` property to be immutable, they could > write `private immutable null|bool|int|float|string|array|object > $property;`. > Yeah, one of my ideas was to first add support for mixed (for which there have been a proposal/PR since quite some time), so that all

Re: [PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-14 Thread Marco Pivetta
On Fri, Feb 14, 2020 at 2:23 PM Máté Kocsis wrote: > > So far, my biggest question (apart from the name) have been how non-typed > properties should behave: as they are implicitly initialized to null if > they don't have an explicit default value (while typed properties remain > uninitialized),

[PHP-DEV] [RFC] [PROPOSAL] Immutable/final/readonly properties

2020-02-14 Thread Máté Kocsis
Hi Internals, I'd like to propose the idea of adding support for immutable/final/readonly properties in PHP 8. My plan is to add a new immutable/final/readonly (the name is up for debate) property modifier to the language so that these kind of properties could only be initialized but not