Re: write(f)ln style exception factory

2014-06-15 Thread Dmitry Olshansky via Digitalmars-d
15-Jun-2014 02:03, Element 126 пишет: On 06/14/2014 09:04 PM, Dmitry Olshansky wrote: Recalling the previous discussion of throwing exception being costly, I thought the idiom of pay as you go is worth incorporating into the standard library. In brief: throw exception(CPU temperature is

Re: write(f)ln style exception factory

2014-06-15 Thread Jacob Carlborg via Digitalmars-d
On 2014-06-15 11:40, Dmitry Olshansky wrote: No, normal exceptions print just fine. e.g. writeln(new Exception(abc)); I'm wondering what's wrong the one I defined, the error message seems to indicate that it doesn't have toString. It's wrong as there is one derived from Exception. Workaround

Re: write(f)ln style exception factory

2014-06-14 Thread Element 126 via Digitalmars-d
On 06/14/2014 09:04 PM, Dmitry Olshansky wrote: Recalling the previous discussion of throwing exception being costly, I thought the idiom of pay as you go is worth incorporating into the standard library. In brief: throw exception(CPU temperature is below, 2.5, K); vs throw new