Unified function call syntax
BLS
nanali at nospam-wanadoo.fr
Mon Sep 8 10:31:54 PDT 2008
Frank Benoit schrieb:
> This feature is planned for D2 and is currently available for array types.
>
> If a global function exists like this:
>
> bool equals(char[] a, char[] b){
> return a == b;
> }
>
> It is possible to use it like this:
> char[] str1 = ...;
> char[] str2 = ...;
>
> str1.equals( str2 ); // compiles OK
>
> But if this is used from within a class that also has a method with the
> name "equals" the syntax above does not work any more:
>
> class A {
> bool equals( Object o ){ ... }
> void foo (){
> bool res = str1.equals(str2); // compile error
> // equals(Object) does not
> // match parameter types (char[],char[])
>
> bool res2 = .equals(str1,str2); // compile OK
> }
> }
>
> Is this a bug or feature?
>
> Will that syntax work with the planned unified function call syntax in D2?
>
>
bool res = str1.equals(str2); // compile error
should become consequently
str1..equals(str2);
seams to be reasonable, bjoern
More information about the Digitalmars-d
mailing list