dynamic classes and duck typing

Simen kjaeraas simen.kjaras at gmail.com
Mon Nov 30 02:51:08 PST 2009


On Mon, 30 Nov 2009 07:10:41 +0100, Walter Bright  
<newshound1 at digitalmars.com> wrote:

> Walter Bright wrote:
>> And here it is (called opDispatch, Michel Fortin's suggestion):
>>   
>> http://www.dsource.org/projects/dmd/changeset?new=trunk%2Fsrc@268&old=trunk%2Fsrc@267
>
> Fixed reported problems with it:
>
> http://www.dsource.org/projects/dmd/changeset?old_path=trunk&old=269&new_path=trunk&new=270

This still does not compile:

struct foo {
	void opDispatch( string name, T )( T value ) {
	}
}

void main( ) {
	foo f;
	f.bar( 3.14 );
}

test.d(10): Error: template instance opDispatch!("bar") does not match  
template
declaration opDispatch(string name,T)

-- 
Simen



More information about the Digitalmars-d mailing list