Unified function call syntax

Sergey Gromov snake.scaly at gmail.com
Sun Sep 7 04:57:52 PDT 2008


Manfred_Nowak <svv1999 at hotmail.com> wrote:
> Frank Benoit wrote:
> > Is this a bug or feature?
> It should be a feature.
> One should be able to introduce the global `equal' by an alias within 
> the body of the class:
> 
>     alias .equal equal;

I think it should be a bug.  When defining

	bool equals(char[] a, char[] b) {...}

you essentially define (semantically)

	class char[] {
		bool equals(char[] b) {...}
	}

Therefore calling A.equals() instead of char[].equals() is not correct.  
Generally speaking, for any given expression, expr.method(), the unified 
function call mechanism should only consider methods accessible from 
typeof(expr) context, not from current scope.




More information about the Digitalmars-d mailing list