>
> Avoiding that confusion will save the industry millions of dollars.
>

On the one hand, you are right, because currently it's not very useful to
effectively provide two
ways of declaring a constant. On the other hand however, if we also
consider a longer term
aim of adding support for object default values (just like what Marco
mentioned):
public read-only DateTimeImmutable $startupTime = new DateTimeImmutable();
then allowing default values for "write-once" properties seems much more
sensible. At this point,
the "million dollar mistake" label doesn't hold anymore since class
constants and "write-once"
properties with default values will actually be two different things. But
we've just ended up at
Marco's suggestion:


>  1. Prevent the parser from accepting default values on write-once
> properties (parser error)
>  2. Re-introduce them once we know what we want to do with default values
> (and it makes sense)
>

Yes, this scenario definitely makes sense. I'm just not yet sold that it
will have any negative effects
if we don't restrict the usage of default values now. I understand that
it's usually advantageous to be
conservative with adding new features - especially when groping in the dark
- since we are the ones
who have to support and fix them later. That's why I was hesitant to add
property covariance to the
proposal.

But this case seems to be much more well-understood than let's say property
covariance would be,
it avoids another special rule while aligning nicely with our longer term
goals, so I think all in all, it is still a
better idea to allow default values than not.

I think what will happen is that people will start requesting for read-only
> properties with default values to be

over-writable-once (a mess): better to remove them from the equation
> completely, no?


I can also imagine people to ask for default values if we disallow them
now. :) After all, we always want
what we don't have. ^^

Does anyone else have any more comments or objections? I wouldn't in the
least want to be stubborn about
this topic, so if anyone has any feelings for/against, it's the best time
to reassure my point of view or
change my mind. :)

Thanks,
Máté

Reply via email to