-> and :: operators

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 9 05:19:15 PDT 2015


On Friday, 9 October 2015 at 10:42:03 UTC, ixid wrote:
> On Friday, 9 October 2015 at 10:15:42 UTC, Jonathan M Davis 
> wrote:
>> That would defeat the purpose of _Uniform_ Function Call 
>> Syntax...
>
> For some reason I'd thought it didn't work when you mixed 
> member function calls with function calls but it seems to do so 
> smoothly.

It works fine in general, and if there's a conflict, it's the 
member function that gets called. So, if you want to guarantee 
that it's a particular free function that gets called, you need 
to not use UFCS (and possibly provide the full import path when 
using it). But in most cases, it's desirable for a member 
function to be able able to override the behavior of a free 
function. The main problem is when they happen to match but do 
completely different things.

- Jonathan M Davis


More information about the Digitalmars-d mailing list