Why exceptions for error handling is so important
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 12 13:35:19 PST 2015
Walter Bright:
> Yes, it still appears to be just a wrapper around returning two
> values, and that has to be done for everything.
There's lot of functional theory behind such ideas.
> There's another downside to returning two values - extra code
> is generated, and it consumes another register. It allocates
> very scarce resources to rare cases - not a recipe for high
> performance.
I suggest to start inverting your point of view: try to look why
the F#/Haskell way of managing errors is good in those
languages...
In bugzilla I asked for a "maybeTo" that is similar to the "to"
Phobos function, but it's @nogc nothrow because it returns an
Nullable!T result.
Bye,
bearophile
More information about the Digitalmars-d
mailing list