The Right Approach to Exceptions
dennis luehring
dl.soluz at gmx.net
Mon Feb 20 10:11:40 PST 2012
Am 20.02.2012 17:36, schrieb Andrei Alexandrescu:
> I understand this seems loose, but again, when you want to do custom
> formatting or i18n this is the way to go. The job of rendering the
> exception as a string must be outsourced (heh) outside the exception,
> and Variant[string] is a simple mechanism to do so.
>
> Andrei
>
>
it is loose and Variant[string] is a simple mechanism for data
transport, but evil in form of compile-time checks, the complete
signature of your information is then (per se) only runtime-checked, how
to prevent difference in the info[] filling and info[] usage over time?
i just mistyped my key, removed a key, used a different, etc... multiply
that by the amount of needed Exceptions and their info-key-variants ...
hell on earth
in the end you will have a bunch of modules wich const-string-keys for
the exception creation and rendering, and then i don't see any real
difference to a specialize exception
More information about the Digitalmars-d
mailing list