If I had my way
Jonathan M Davis
jmdavisProg at gmx.com
Mon Dec 12 21:28:05 PST 2011
On Monday, December 12, 2011 21:17:10 Mehrdad wrote:
> On 12/12/2011 8:25 PM, Jonathan M Davis wrote:
> > There have been a variety of suggestions on how to do it - including one
> > similar to what you're suggesting with the this keyword. However, it
> > still leaves the problem of disambiguation that I mentioned. What
> > happens when there's a free function and a member function with the
> > same name and same parameters? Which one gets called?
>
> Member functions always take precedence in C#, and it works perfectly
> well. There's really no problem in practice.
I'm not saying that it can't be done. I'm just saying that all of the corner
cases and the like have to be sorted out such that the feature is completely
defined, and we don't have ambiguities that are going to cause problems. Things
are complicated enough with alias this and opDispatch and the like. Adding yet
another way to add functions to a type complicates things that much further.
So, UFCS needs to be carefully designed, and that's more of an issue IMHO than
the exact syntax used to determine if a function is supposed to work with
UFCS.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list