On Mon, Apr 18, 2016 at 8:54 PM, Stanislav Malyshev <smalys...@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.