On 10/14/2012 09:14 AM, Maxim Fomin wrote:
On Sunday, 14 October 2012 at 07:01:30 UTC, Tommi wrote:
Actually, it seems that alias this has precedence over UFCS. So, a
free function opUnary wouldn't ever suit better than an actual method
opUnary of the thing referred to by that alias this.

http://dpaste.dzfl.pl/d0a4431d

Free function doesn't suit better than actual method. The issue is
absence of the actual method.

opUnary method has priority over alias this, which does make sense
because alias this is chosen only when it is impossible to apply
operation over A type. If this request is approved and compiler has
opUnary definition outside type (which suits better then alias this)
such function would hijack alias this. If not, there is a new case when
something is going special than at usual cases and only for the purpose
of writing operator overloading methods outside the body of the type.

The goal must be to get rid of all special behaviour that can result in
strange interactions.
Add the suitable operator function templates to built-in types. Always
rewrite operators to operator function calls. Problem solved.
(And people are already asking for custom constant folding procedures,
even without having this in place to use as a supporting argument.)

Reply via email to