On 09/06/15 11:35, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= <[email protected]>" wrote:

I agree, I have conventions in my C++ code where member functions and
free functions shouldn't mix.

But given C++ templates lack of type safety, I'm not surprised that BS
pushes it.  It also does not solve "std::begin" issues better than a
method-extension feature would have done.
Actually, that's an important point for D as well.

I would have a considerably less problem with UFCS had it been limited only to explicit declaration.

So:
void func( ref A a, int b ) ...

A a;
a.func(12); // Should not compile IMHO

but:
@property void func( ref A a, int b ) ...

should work. Same goes for dropping the () to zero arguments function calls. Once that needs to be a conscious decision by the programmer, my problems with UFCS are greatly reduced (though, to be fair, not completely alleviated).

Shachar

Reply via email to