UFCS and constructors

Timon Gehr timon.gehr at gmx.ch
Tue Jul 2 12:47:07 PDT 2013


On 07/02/2013 07:58 PM, Jonathan M Davis wrote:
> On Tuesday, July 02, 2013 14:46:41 Timon Gehr wrote:
>>> Do we want to keep it?
>>
>> There is no reason to artificially ban it.
>
> There's nothing artificial about it. Constructors are not normal functions and
> should not be treated as such.
> They're fundamentally different from normal
> functions.
>
> Also, in all other cases, UFCS involves using a free function as if it were a
> member function, so it's incredibly bizarre as well as inconsistent with the
> rest of UFCS to allow constructors to be used with it.
>
> - Jontahan M Davis
>

It is an artificial limitation, because you need to add an explicit 
check after symbol lookup to ban constructors.


Analogies are always broken, but the rest of the post reads to me 
roughly like:

"Dogs are not pets, and should not be treated as such.
They are fundamentally different from pets.

Also, there are no other pets that bark, so it's incredibly bizarre as 
well as inconsistent with the rest of the notion of a 'pet' to have a 
pet dog.

- Tmion M Gehr
"


This has happened before. What am I missing?


More information about the Digitalmars-d mailing list