« first day (4931 days earlier)      last day (13 days later) » 

7:02 AM
@IluTov I can add one: in the MongoDB driver, we have an interface for people to extend in order to encode/decode data to/from BSON. When encoding, we don't want to prescribe what values the class has to accept, so in order for that to work the interface would need the never type so that implementing classes can then accept only what they support.
Using null is a workaround, but any implementation that does not accept null and throws an exception when encountering it technically violates the LSP.
I'd like to have a never type for parameters, even if only in interfaces and abstract method declarations
 
7:22 AM
@alcaeus It sounds to me like these should be associated types. Otherwise you cannot model relationships of the different usages of never, i.e. which are supposed to be the same.
 
 
2 hours later…
9:15 AM
@IluTov That's fair enough - something like public function encode(void $value): BSONValue would work just as well
never does seem a little strange for a parameter type
 
9:42 AM
@alcaeus What I meant is either interface Encoder<T> { ... }, or interface Encoder { associatedtype T; ... } if that's easier to implement. At least then, you can meaningfully check that the methods in that interface use the variable types consistently.
E.g. if you had an interface for both encoding and decoding, you could add a single associated type T, and verify that both encode and decode use T consistently, rather than them diverging. For never, there wouldn't be a way to specify these relationships.
 
 
4 hours later…
2:07 PM
@JRL We could also solve that with generics. :ducks:
Which is what @IluTov is saying as well.
 
3:06 PM
Generics will do fine. At this point I'm just afraid to ask for them
 
4:01 PM
wow. looking at the results for the rfc vote - 30 for and only 1 against. well done guys!
 
I'm still in shock.
 
@Crell That happens when one does a thorough job :-)
 
A thorough job didn't help PFA or operator overloads. :-)
Or aviz for that matter.
 
@Crell It's had a few rounds.
That always seems to help (see primitive types and also short closures).
 
@Crell PFA had several key voters disagreeing too. Rasmus, Nikita, Dmitry, Derick,…
Ilija also didn't like them.
 
4:16 PM
I still feel like there ought to be a less-engine-invasive way to do them that would have caused less concern.
 
One point to note is that two of the three common use cases of PFA made it into PHP - the foo(...) syntax was accepted as standalone. And the delayed_execution(1, 2, 3, ...) essentially is fn() => delayed_execution(1, 2, 3).
A lot of the use cases are solved with short closures to be honest.
It's a couple bytes more, it's largely good enough - the merits of PFA are now much smaller than they'd been back then.
 
4:37 PM
Well, the PFA work was all done well-after short-closures were added.
I agree that short-closures make a reasonable poor-man's PFA in many cases, but not all. My Serde library has a spot where I say explicitly "this could be a lot tidier with PFA." :-)
It would also be a lot easier to read, especially when doing piping.
 
4:50 PM
@Crell Feels a little like my #[\Override] RFC. Pretty skeptical reactions on the list and the vote almost unanimous.
 
@TimWolla For that one I'm actually really surprised :-D
 
I think I filed that one as "meh, I'll ignore it, but at least someone seems to like it and it doesn't hurt anything" in my head. :-)
 
@Crell It hurts nobody until someone decides they need phpstan rules enforced on projects which force #[Override].
 
JRL
@Crell can we though? :)
well, much congrats so far. it always feels like a lottery how the votes go with people who don't communicate anywhere. seems like they are breaking your way this time.
 
5:40 PM
@Crell Indeed. Joe himself being unsure about them tipped my vote.
 
 
2 hours later…
7:35 PM
@IluTov Interested in working on a better implementation for a v2? :-P
 
 
2 hours later…
9:58 PM
@Crell I wasn't implying that I can do it better than Joe. :) Quite the opposite.
 
10:12 PM
I still think if we approach it not as true PFA but as a shorthand for short-closures, and just throw a nice symbol at it, we could get something 90% as good for 10% the effort.
 
10:25 PM
@Crell I'm not sure I remember correctly why it wasn't done this way. Two issues I can think of right now: It requires capturing all params either by value (which will not work for reference params) or by reference (which will change the params values until the function is fully applied). And param evaluation time becomes weird. E.g. with foo(bar(), ?), bar() would be called when fully applied.
 
References are the devil.
 
10:41 PM
Yeah, if you do push PFA through, definitely don't half-ass it :-D
 

« first day (4931 days earlier)      last day (13 days later) »