static try?

Mehrdad wfunction at hotmail.com
Wed Nov 2 01:38:40 PDT 2011


On 11/1/2011 11:55 PM, Don wrote:
> On 31.10.2011 02:21, Mehrdad wrote:
>> I've written this piece of code a fair number of times:
>>
>> static if (is(typeof(foo()))) { foo(); }
>> else { bar(); }
>>
>> When the expression inside the condition (i.e. the call to foo()) gets
>> complicated, you get lots of code duplication and things become harder
>> to read.
>
> IMHO the only problem is the is(typeof()) syntax.
> Otherwise I don't see how this has any more code duplication than:
>
> if( foo(lots_of_parameters) )
>     foo(lots_of_parameters);
> else bar();
Huh?

sorry but I'm confused as how that's related to static try/catch...


More information about the Digitalmars-d mailing list