On Sun, 27 Apr 2025 at 14:24, Niels Dossche <[email protected]> wrote:
> On 26/04/2025 09:17, Larry Garfield wrote:
>
> > * Exceptions are very expensive, the hierarchy is confusing, and
> handling them properly is a major pain. Failing to handle them properly is
> very easy since you have no way of knowing what exceptions the code you're
> calling might throw, or its nested calls, etc. That makes them poorly
> suited for mundane, predictable error conditions.
> I get the point of having checked exceptions, and I suppose it would be
> nice.
> Hierarchy: I don't think the hierarchy is that confusing, can you
> elaborate?
> Regarding performance however, rather than introducing yet another
> completely new concept to do almost the same thing, why not try to improve
> exception performance instead?
>
Came here to say the same.
Also: Either
/Option
/Maybe
types, with some basic generics,
even if
only at documentation + PHPStan/Psalm level?
I'm coming from months of Go development, and I really just want my
exceptions (with traces by default) back, tbh, even if it means performance
suffers.
I just opened a PR that makes instantiating exceptions much much faster,
> and this is only after like 15 mins of work. I'm sure there's even more to
> gain.
Nice!
Marco Pivetta
https://mastodon.social/@ocramius
https://ocramius.github.io/