Re: [PHP-DEV] Union `&` operator

2020-11-23 Thread Eugene Sidelnyk
I am wondering why don't you create some kind of donation system? So that customers (end programmers) can vote for features by means of their money. In russian it is known as "Голосуй рублём". This will give the community an ability to provide feedback of what features they like or don't. BTW,

Re: [PHP-DEV] Union `&` operator

2020-11-14 Thread G. P. B.
On Sat, 14 Nov 2020 at 11:17, Eugene Sidelnyk wrote: > Levi will not have time for this. Who else do you suggest? > Please do NOT prompt someone to implement a feature for you for free. Many of us would like intersection types but it takes time to implement it. And as a reminder most people who

Re: [PHP-DEV] Union `&` operator

2020-11-14 Thread Eugene Sidelnyk
Levi will not have time for this. Who else do you suggest? On Sun, Nov 8, 2020, 6:47 PM Eugene Sidelnyk wrote: > > As for when to allow them: as others have suggested in this thread, keep > it simple for now, and only allow intersection of class/interface > references. > > Yes, I think that

Re: [PHP-DEV] Union `&` operator

2020-11-08 Thread Eugene Sidelnyk
> As for when to allow them: as others have suggested in this thread, keep it simple for now, and only allow intersection of class/interface references. Yes, I think that single intersection type should support just one class and any/or any number of interfaces with the condition that they don't

Re: [PHP-DEV] Union `&` operator

2020-11-08 Thread Eugene Sidelnyk
> 1. Do we support complex types combining unions with intersections? We can do it at any time, so we should not hurry with this. If we think about why people would like to do such complex types - probably it is because PHP currently doesn't support methods overloading. Thus we'd rather

Re: [PHP-DEV] Union `&` operator

2020-11-08 Thread Marco Pivetta
Hey Eugene, On Sat, Nov 7, 2020 at 4:13 PM Eugene Sidelnyk wrote: > ```php > function foo(A & B & E $object) { > // some work > > var_dump($object); > } > ``` > Fully support this for parameter, property and return types: already making good use of intersection types since a few years. As

Re: [PHP-DEV] Union `&` operator

2020-11-07 Thread Larry Garfield
On Sat, Nov 7, 2020, at 2:47 PM, Sara Golemon wrote: > On Sat, Nov 7, 2020 at 9:33 AM Olle Härstedt wrote: > > > 2020-11-07 15:12 GMT, Eugene Sidelnyk : > > > function foo(A & B & E $object) { > > > // some work > > > var_dump($object); > > > } > > > > > > > You mean intersections? Psalm

Re: [PHP-DEV] Union `&` operator

2020-11-07 Thread Sara Golemon
On Sat, Nov 7, 2020 at 9:33 AM Olle Härstedt wrote: > 2020-11-07 15:12 GMT, Eugene Sidelnyk : > > function foo(A & B & E $object) { > > // some work > > var_dump($object); > > } > > > > You mean intersections? Psalm supports this notation. > > IIRC we discussed intersection data types when

Re: [PHP-DEV] Union `&` operator

2020-11-07 Thread Olle Härstedt
https://wiki.php.net/rfc/intersection_types 2020-11-07 16:37 GMT+01:00, Eugene Sidelnyk : > Yes. > And I think it will be good if enforced by language. > > On Sat, Nov 7, 2020, 5:33 PM Olle Härstedt wrote: > >> 2020-11-07 15:12 GMT, Eugene Sidelnyk : >> > When you follow ISP, you probably would

Re: [PHP-DEV] Union `&` operator

2020-11-07 Thread Eugene Sidelnyk
Yes. And I think it will be good if enforced by language. On Sat, Nov 7, 2020, 5:33 PM Olle Härstedt wrote: > 2020-11-07 15:12 GMT, Eugene Sidelnyk : > > When you follow ISP, you probably would have a lot of interfaces. > > Thus, client code may require an object to implement a bunch of >

Re: [PHP-DEV] Union `&` operator

2020-11-07 Thread Olle Härstedt
2020-11-07 15:12 GMT, Eugene Sidelnyk : > When you follow ISP, you probably would have a lot of interfaces. > Thus, client code may require an object to implement a bunch of interfaces > depending on functionality needed. > > Consider class `Bar`: > > ```php > > interface A {} > > interface B {} >

[PHP-DEV] Union `&` operator

2020-11-07 Thread Eugene Sidelnyk
When you follow ISP, you probably would have a lot of interfaces. Thus, client code may require an object to implement a bunch of interfaces depending on functionality needed. Consider class `Bar`: ```php interface A {} interface B {} interface C {} interface D {} interface E {} class Bar