Re: [RFC:generics]
| From: | Sara Golemon | Date: | Wed, 20 Apr 2016 04:01:33 +0000 |
| Subject: | Re: [RFC:generics] | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-92519@lists.php.net to get a copy of this message | ||
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