Re: [VOTE] Catching Multiple Exception Types

From: Date: Tue, 19 Apr 2016 01:09:06 +0000
Subject: Re: [VOTE] Catching Multiple Exception Types
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-92436@lists.php.net to get a copy of this message
On Mon, Apr 18, 2016 at 8:54 PM, Stanislav Malyshev <smalyshev@gmail.com> wrote: > Hi! > > > catch constitutes a formal signature, exactly like a function signature. > In > > my mind, this proposal and the union types proposal are intrinsically > tied. > > If we have one, we must have the other. If not, we're inducing a sadness. > > This has nothing to do with union types. It is just a shortcut for > repeated catch() clauses, it does not introduce anything into type > system, capture existing use case, and doesn't make anything more > complicated. While union types introduce a lot of new things, make > everything dealing with types more complicated and the need for them, > unless we import a real lot of other concepts like type pattern matching > is quite unclear. So I don't think this has much in common. > It's about the perception of consistency. "Oh, I can do this! Neat:" function neat(Foo | Bar $a) { ... } "But I can't do this? WTF?" catch (FooException | BarException $ex) { ... } And vice-versa. The perception revolves around the fact that both appear to be signatured, regardless of how they're implemented in the engine.

« previous php.internals (#92436) next »