UFCS for struct opCall?

Maxim Fomin maxim at maxim-fomin.ru
Tue Apr 9 07:10:21 PDT 2013


On Tuesday, 9 April 2013 at 09:03:55 UTC, Timon Gehr wrote:
> This is getting old. We should discuss the general issue, issue 
> 9857 is just another instance of it.
>
> Namely:
>
> If the language defines a rewrite from A to B and from B to C, 
> is a rewrite from A to C implied?

If a + b is rewritten as a.opBinary according to operator 
overloading and a.opBinary as opBinary(a,..) is rewritten 
according to UFCS, it does not necessarily mean that this works 
together.

> I'd say yes, because this is the obvious behaviour. If it is 
> not there, we have to add a magical "has already been 
> rewritten" flag, countering intuition. Furthermore, as far as I 
> am concerned, this is easier to implement. DMD's inconsistent 
> behaviour has been discussed on d.D.learn multiple times.

 From what I know there is no code in dmd that intentionally 
disables the feature and it would be harder to implement the 
feature than to keep things as they stand (according to 
discussions on bugzilla).

> Furthermore, the only argument brought up against this so far 
> is that some language constructs are special and ergo they must 
> be mutually incompatible. This is a complete non sequitur.
>

It seems that you ignore arguments (strictly speaking you are 
simplifying them).

>> Jonathan Davis doesn't like this. For more information I 
>> suggest to take
>> a look at the thread in Bugzilla.
>> ...
>
> There is not more information there, it's just given in a blown 
> up representation. He does not justify his opinion.

That's not funny more. It is really interesting to hear from you 
saying that somebody does not provide bases for opinions because 
it is you who are known to post argument without justification 
ignoring everything previous (for ex. 
http://www.digitalmars.com/d/archives/digitalmars/D/Possible_UDA_bug_190800.html).


More information about the Digitalmars-d mailing list