UFCS and constructors

John Colvin john.loughran.colvin at gmail.com
Wed Jul 3 08:11:43 PDT 2013


On Wednesday, 3 July 2013 at 15:05:29 UTC, Timon Gehr wrote:
> On 07/03/2013 04:53 PM, John Colvin wrote:
>> On Wednesday, 3 July 2013 at 03:22:16 UTC, Jonathan M Davis 
>> wrote:
>>> That is _very_ broken IMHO. It makes no sense for parens to be
>>> optional with
>>> opCall. The whole point of opCall is to overload the parens!
>>
>> So much about optional parenthesis is broken. I really wish 
>> things
>> weren't going that way, it obfusticates the difference between 
>> a
>> callable and the result in a really nasty way, and it doesn't 
>> work for
>> function pointers (nor does UFCS unfortunately).
>
> Yes, UFCS works.

struct A {}

void foo(A a) {}

void main()
{
	A a;
	auto foo_ptr = &foo;
	a.foo_ptr(); //Error: undefined identifier 'foo_ptr'
	a.foo_ptr;   //Error: no property 'foo_ptr' for type 'A'
}


More information about the Digitalmars-d mailing list