www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D - more problems searching for overloaded functions (0.76)

↑ ↓ ← one_mad_alien hotmail.com writes:
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
↑ ↓ → "Walter" <walter digitalmars.com> writes:
<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 me

 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

 -- with the alias at line 8
 search.d(8): alias name conflicts with Derv.name at search.d(9)
 */
 ------------------------------------

Jan 01 2004