Re: [RFC:generics]
| From: | Jesse Schalken | Date: | Wed, 20 Apr 2016 04:30:18 +0000 |
| Subject: | Re: [RFC:generics] | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92520@lists.php.net to get a copy of this message | ||
I agree.
On Wed, Apr 20, 2016 at 2:01 PM, Sara Golemon <pollita@php.net> wrote:
> On Tue, Apr 19, 2016 at 7:56 PM, Jesse Schalken <me@jesseschalken.com>
> wrote:
> >> class Collection<T as (Traversable | Countable)> {...
> >
> > I think the "where T is Traversable, T is Countable" syntax was intended
> to
> > represent the intersection (i.e. a "Countable Traversable"), not the
> union.
> >
> > So you would need an intersection syntax
> >
> > class Collection<T as Traversable & Countable> {...
> >
> And that's precisely my point for why reusing the suggested syntax for
> union types makes sense. You can to specify either intersection or
> union (or potentially a complex combination of the two (A | (B & C))),
> rather than being limited to intersections only.
>
> -Sara
>