The Right Approach to Exceptions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Feb 20 13:02:21 PST 2012


On 2/20/12 2:01 PM, foobar wrote:
> Seconded. Reflection seems a much better solution for this.

Absolutely.

> The i18n table would map (exception type) -> (language, format string)
> and the i18n formatter would use reflection to map field values to the
> format string.
> a format string would be e.g. "File {filename} not found" and the
> formatter would replace {filename} with e.class.getField("filename").
>
> This does not require any modifications to the exception mechanism.

Yah, but the reflection engine would have to present RTTI in a uniform 
manner... such as, Variant[string]. Bane of my life: I'm always right :o).


Andrei


More information about the Digitalmars-d mailing list