www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - interface default implementation mixin

reply "JS" <js.mdnq gmail.com> writes:
I'm trying to create a default interface mixin tempate. Some 
prototype code I've come up with generates the members property 
but I get an error I don't understand:

http://dpaste.dzfl.pl/58c0392d

void myfunc(float a, int b, string c) { a.myfunc(a, b, c); }

/d650/f247.d(70): Error: no property 'myfunc' for type 'float'


The mixin doesn't seem to work properly though even though it is 
generating a valid implementation of the interface... unless I'm 
missing something.
Jul 04 2013
parent reply "Dicebot" <public dicebot.lv> writes:
On Thursday, 4 July 2013 at 11:13:54 UTC, JS wrote:
 I'm trying to create a default interface mixin tempate. Some 
 prototype code I've come up with generates the members property 
 but I get an error I don't understand:

 http://dpaste.dzfl.pl/58c0392d

 void myfunc(float a, int b, string c) { a.myfunc(a, b, c); }

 /d650/f247.d(70): Error: no property 'myfunc' for type 'float'


 The mixin doesn't seem to work properly though even though it 
 is generating a valid implementation of the interface... unless 
 I'm missing something.
local variable names ('a' in function args list) shadow those in outer scopes ('a' as a class member)
Jul 04 2013
parent reply "JS" <js.mdnq gmail.com> writes:
On Thursday, 4 July 2013 at 11:32:25 UTC, Dicebot wrote:
 On Thursday, 4 July 2013 at 11:13:54 UTC, JS wrote:
 I'm trying to create a default interface mixin tempate. Some 
 prototype code I've come up with generates the members 
 property but I get an error I don't understand:

 http://dpaste.dzfl.pl/58c0392d

 void myfunc(float a, int b, string c) { a.myfunc(a, b, c); }

 /d650/f247.d(70): Error: no property 'myfunc' for type 'float'


 The mixin doesn't seem to work properly though even though it 
 is generating a valid implementation of the interface... 
 unless I'm missing something.
local variable names ('a' in function args list) shadow those in outer scopes ('a' as a class member)
I originally put this in front and got rid of the error but the code would fail to build with no error code so I thought it was something else. http://dpaste.dzfl.pl/f4c6a503 d-ide compiles the code but says build failed and I can't execute it. Using dpaste produced the expected result... so I guess it's an issue with d-ide.
Jul 04 2013
parent "JS" <js.mdnq gmail.com> writes:
On Thursday, 4 July 2013 at 19:58:11 UTC, JS wrote:
 On Thursday, 4 July 2013 at 11:32:25 UTC, Dicebot wrote:
 On Thursday, 4 July 2013 at 11:13:54 UTC, JS wrote:
 I'm trying to create a default interface mixin tempate. Some 
 prototype code I've come up with generates the members 
 property but I get an error I don't understand:

 http://dpaste.dzfl.pl/58c0392d

 void myfunc(float a, int b, string c) { a.myfunc(a, b, c); }

 /d650/f247.d(70): Error: no property 'myfunc' for type 'float'


 The mixin doesn't seem to work properly though even though it 
 is generating a valid implementation of the interface... 
 unless I'm missing something.
local variable names ('a' in function args list) shadow those in outer scopes ('a' as a class member)
I originally put this in front and got rid of the error but the code would fail to build with no error code so I thought it was something else. http://dpaste.dzfl.pl/f4c6a503 d-ide compiles the code but says build failed and I can't execute it. Using dpaste produced the expected result... so I guess it's an issue with d-ide.
using command line compiles fine... so it is an issue with d-ide.
Jul 04 2013