The Right Approach to Exceptions

Nick Sabalausky a at a.a
Mon Feb 20 16:01:40 PST 2012


"Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message 
news:jhuccs$1tuf$4 at digitalmars.com...
> 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).
>

It's easy to always be right when you twist your argument after-the-fact to 
match what was eventually agreed.




More information about the Digitalmars-d mailing list