Is this RFC going to play nice with Void return types?

If we get unions, then doesn't it follow that the declaration goes as this?

function foo(A | B $val = null): JustChill | void
{}

That's a nullable typehint and a nullable return type surely.
On 26 Apr 2016 4:07 p.m., "Joe Watkins" <pthre...@pthreads.org> wrote:

> Dmitry,
>
> > "Foo | null" doesn't make sense without "Union Types".
>
> I just said that in a chat room, and someone said "I prefer Bar | null over
> ?Bar, I find myself missing the ?".
>
> So maybe there is rationale for choosing a syntax for nullable first,
> independent of the question of return and params, and unions or
> intersections ?
>
> Levi,
>
> > Joe seems to just want nullables to have an outcome so it is no longer
> blocking typed properties.
>
> I want it to have the right outcome, but yes, basically ... get off my lawn
> :D
>
> I am persuaded that Bar | null could be perceived as clearer regardless of
> the introduction of multi types, it may be a worthwhile conversation/vote.
>
> Cheers
> Joe
>
> On Tue, Apr 26, 2016 at 3:53 PM, Dmitry Stogov <dmi...@zend.com> wrote:
>
> > "Foo | null" doesn't make sense without "Union Types".
> > Voting for one RFC first makes a preference and unfair.
> >
> > Voting for two different RFCs with 2/3 majority is not good as well.
> > But this is the best option from my point, in case both pass we may make
> > additional voting with simple majority "Union" or "Nullable" or
> > "Union+Nullable".
> >
> > Thanks. Dmitry.
> >
> > ________________________________________
> > From: Levi Morrison <morrison.l...@gmail.com>
> > Sent: Tuesday, April 26, 2016 17:47
> > To: Dmitry Stogov
> > Cc: Bob Weinand; internals; Joe Watkins
> > Subject: Re: [PHP-DEV] [RFC] Patch for Union and Intersection Types
> >
> > On Tue, Apr 26, 2016 at 8:30 AM, Dmitry Stogov <dmi...@zend.com> wrote:
> > >
> > >
> > > On 04/26/2016 05:19 PM, Bob Weinand wrote:
> > >>>
> > >>> Am 26.04.2016 um 15:33 schrieb Dmitry Stogov <dmi...@zend.com>:
> > >>>
> > >>> hi Levi,
> > >>>
> > >>> It looks like your "work" on "Nullable Types" RFC was intended to win
> > >>> time for this patch and block "Nullable Types" again.
> > >>> Actually, you have been blocking it for more than a year :(
> > >>>
> > >>> I'm going to push my own RFC for voting together with "Union Types".
> > >>>
> > >>> https://wiki.php.net/rfc/nullable_return_types
> > >>>
> > >>> At least, it has up to date implementation.
> > >>>
> > >>> We discussed this internally 2-3 weeks ago, and my politeness (or/and
> > >>> stupidity) allowed you  to pass your version for common discussion.
> > >>> Now I can see your real reason :(
> > >>>
> > >>> Both "Union Types" and "Nullable Types" may make sense, and both
> should
> > >>> be voted at the same time.
> > >>> Tomorrow is time to start voting. Right?
> > >>>
> > >>> Thanks. Dmitry.
> > >>>
> > >>>
> > >>> ________________________________________
> > >>> From: Levi Morrison <morrison.l...@gmail.com>
> > >>> Sent: Tuesday, April 26, 2016 02:37
> > >>> To: internals
> > >>> Subject: [PHP-DEV] [RFC] Patch for Union and Intersection Types
> > >>>
> > >>> Internals,
> > >>>
> > >>> Joe Watkins and Bob Weinand have worked out a [proof-of-concept patch
> > >>> for union types][1]. Please go download it and experiment with it.
> > >>>
> > >>> A few things to note:
> > >>>
> > >>>   * This patch includes intersection types. However, a type
> expression
> > >>> must be either a union type or an intersection type; it doesn't
> > >>> support both such as `Array | (Countable & Traversable)`.
> > >>>   * This patch adds `null`, `true` and `false` for type declarations.
> > >>>   * This patch includes conversion rules for weak types.
> > >>>   * It does not have short-hand for unions with null (`?Foo` being
> > `Foo |
> > >>> Null`)
> > >>>
> > >>> These features (or omitted ones) are not necessarily what will be
> > >>> voted on. Rather this patch allows us to experiment with these
> > >>> features in code. This experience should be helpful for us to
> solidify
> > >>> how we actually feel about these features.
> > >>>
> > >>> I especially would like people to try out the conversion rules for
> > >>> scalar types as it has been a point of discussion.
> > >>>
> > >>>   [1]: https://github.com/php/php-src/pull/1887
> > >>
> > >> Hey Dmitry,
> > >>
> > >> Please, do not accuse us of blocking the nullables. This wasn't
> > >> intentional and rather a coincidence that we provided a patch right
> now.
> > >> First we wanted to concentrate our forces on getting a great 7.0 out
> > >> before starting this RFC (as it didn't make it in time for going into
> > 7.0
> > >> too as we waited for result on scalar types in general first).
> > >> Then, as you're aware Levi had absolutely no time for a few months…
> Now,
> > >> he has time to manage things and we could move ahead quickly and write
> > the
> > >> patch up.
> > >
> > > I know, we all like to make our best for PHP.
> > > Sorry, if I was too emotional.
> > >>
> > >> I'd like to hold first a formal (and binding) vote on whether "null |"
> > or
> > >> "?" should be used (in case both RFCs pass). Rushing things through
> > right
> > >> now might just us ending up with semantics the vast majority dislikes.
> > >
> > > I didn't exactly get, what do you propose. One RFC with voting for
> > > "Nullable" or "Union"?
> > >
> > > Thanks. Dmitry.
> > >
> > >>
> > >> Thanks,
> > >> Bob
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > I believe the intention here is to decide whether we do the short-hand
> > syntax for nullable types or only the long-form. I can understand the
> > rationale of not having both or at least dis-allowing the syntax to
> > mix them. For example, I don't think anyone really likes allowing
> > this: `?Array | Travsersable` as .
> >
> > However, if the union types RFC does not pass then it seems odd (to me
> > at least) to use the expression `Foo | Null` instead of `?Foo`, but I
> > know Bob would like the long-form in all cases, hence why he would
> > like a vote. Joe seems to just want nullables to have an outcome so it
> > is no longer blocking typed properties.
> >
> > Is that a correct summary, Bob and Joe?
> >
>

Reply via email to