Re: [RFC] Union Types v2

From: Date: Thu, 26 Sep 2019 00:17:03 +0000
Subject: Re: [RFC] Union Types v2
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-107320@lists.php.net to get a copy of this message
On Tue, Sep 24, 2019, at 3:05 PM, Sara Golemon wrote: > On Tue, Sep 24, 2019 at 12:24 PM Claude Pache <claude.pache@gmail.com> > wrote: > > The choice of supporting precisely the two literal values > > null and > false > > is not arbitrary: They are the two values that are the most often used as > > sentinel values (for indicating failure or absence). It is true that > true is > > also sometimes used as sentinel value (more rarely and not among the > > internal functions), but the same can be said of other literal values > > (one of your examples includes 0). > > > While I personally think false makes sense as an allowed > "type", I also > don't want to see the union types RFC get held up on such a tiny detail. > > I would propose either of the following alternatives: > 1/ Remove false from the proposal. It can always be added at a > later > time, but not taken away. > 2/ Make this detail a sub-vote. I would suggest that this sub-vote should > also be subject to a 2/3 majority in order to pass. > > -Sara I would tend to agree with Sara. That seems to be the only issue of contention and it is (AFAIK) reasonably straightforward to add "later" without blocking the rest of Union types. It would mean some functions wouldn't be able to get a fully accurate return type yet but... they've survived this long without them, they can wait a bit longer while this gets settled and/or some even more robust alternative is found. --Larry Garfield

« previous php.internals (#107320) next »