D - more problems searching for overloaded functions (0.76)
- one_mad_alien hotmail.com (32/32) Dec 19 2003 I though alias allowed base class members to be imported as members of t...
- Walter (6/38) Jan 01 2004 At the moment, you're right. I'll need to study this.
I though alias allowed base class members to be imported as members of the current class ! DMD 0.76 (winXP) I'm still of the opinion that Java has the right approach when it comes to function searching rather than following the (imho) daft c++ model. is the only way to get arround this to change the name of the func ? and I think the error msg is backwards, it would seem more logical to me to write search.d(9): argument types (char[1],char[1]) does not match function name () [[then the line /file of the matched function]] i.e. the info that is important to the programmer first. ------------ search.d --------------------- class Base { char[] name() { return "<name>"; } char[] name( char[] l, char[] r ) { return l~"<name>"~r; } } class Derv { alias name name; char[] name() { return name( "a", "b" ); } } int main( char[][] args ) { Base b = new Derv(); printf("rv:%.*s\n", b.name() ); return 0; } /* -- without the alias at line 8 search.d(9): function name () does not match argument types (char[1],char[1]) -- with the alias at line 8 search.d(8): alias name conflicts with Derv.name at search.d(9) */ ------------------------------------
Dec 19 2003
<one_mad_alien hotmail.com> wrote in message news:bs05rh$1bv$1 digitaldaemon.com...I though alias allowed base class members to be imported as members of the current class ! DMD 0.76 (winXP) I'm still of the opinion that Java has the right approach when it comes to function searching rather than following the (imho) daft c++ model. is the only way to get arround this to change the name of the func ?At the moment, you're right. I'll need to study this.and I think the error msg is backwards, it would seem more logical to metowrite search.d(9): argument types (char[1],char[1]) does not match function name()[[then the line /file of the matched function]] i.e. the info that is important to the programmer first. ------------ search.d --------------------- class Base { char[] name() { return "<name>"; } char[] name( char[] l, char[] r ) { return l~"<name>"~r; } } class Derv { alias name name; char[] name() { return name( "a", "b" ); } } int main( char[][] args ) { Base b = new Derv(); printf("rv:%.*s\n", b.name() ); return 0; } /* -- without the alias at line 8 search.d(9): function name () does not match argument types(char[1],char[1])-- with the alias at line 8 search.d(8): alias name conflicts with Derv.name at search.d(9) */ ------------------------------------
Jan 01 2004