Re: [Early Feedback] Pattern matching

From: Date: Sat, 22 Jun 2024 02:13:28 +0000
Subject: Re: [Early Feedback] Pattern matching
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Friday, 21 June 2024 at 19:19, Larry Garfield <[email protected]> wrote:
> On Fri, Jun 21, 2024, at 3:35 PM, Brandon Jackson wrote:
> > 4. Object matching
> > Absolutely a separate rfc please. Definitely needs discussion. Could
> > intersect another potentially preferred solution like type aliases.
> > Sending one or the other into anti-pattern world.
> > Maybe a solution similar to this would be preferred:
> > 
> > php type MyType = Foo&Bar $foo = $bar as MyType|string
> 
> 
> As noted, this is on the ADT hot path so postponing it is problematic. Especially holding it on
> type aliases, which have been discussed for longer than this RFC has been around (nearly 4 years)
> and yet no actual proposal has ever been put forward. It's unwise to wait for such a feature,
> especially when most likely implementations would dovetail well with patterns anyway.

I agree with Larry here, this is core to pattern matching in general and necessary for ADTs to make
any sense (and I want them yesterday).
Moreover, I cannot see how this will conflict with anything vaguely close to type aliases.

Best regards,

Gina P. Banyard


Thread (79 messages)

« previous php.internals (#123746) next »