Let's improve D's exceptions

via Digitalmars-d digitalmars-d at puremagic.com
Thu May 14 03:24:44 PDT 2015


On Thursday, 14 May 2015 at 01:31:22 UTC, Adam D. Ruppe wrote:
> The local alias tells which kind of exception is relevant in 
> this context. Then the local enforce collects the arguments to 
> the function and throws a new subclass of the base specific to 
> this function call.

Using alias like this makes code hard to read. Error types should 
be humanly deducible at the failure site.

You'd be better off having non-ignorable result types (e.g. 
tagged union/variant/algebraic) and a typed way to turn those 
into exceptions.


More information about the Digitalmars-d mailing list