dynamic classes and duck typing

Lutger lutger.blijdestijn at gmail.com
Sun Nov 29 05:23:22 PST 2009


Denis Koroskin wrote:

> On Sun, 29 Nov 2009 16:02:24 +0300, Lutger <lutger.blijdestijn at gmail.com>
*snip*
>> If you want to resolve the symbol at runtime I think you can get a better
>> error message for throwing an exception or assertion. I don't have the
>> svn
>> dmd, so this isn't tested:
>>
>> void opDispatch(string name)(string file = __FILE__, int line = __LINE__)
>> {
>>   if ( !dynamicDispatch(name) )
>>   {
>>     // line and file are default initialized from the call site:
>>     throw new MethodMissingException(name, file, line);
>>   }
>> }
>>
>>
> 
> IIRC, this trick only works when __FILE__ and __LINE__ are both template
> arguments.

hey that's right. That means when Walter fixes the current bug with template 
parameters, good compile time error messages are possible after all.





More information about the Digitalmars-d mailing list