UFCS for struct opCall?

Timon Gehr timon.gehr at gmx.ch
Tue Apr 9 12:08:50 PDT 2013


On 04/09/2013 04:10 PM, Maxim Fomin wrote:
> 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.
>

If it does not then it has to be specified that the first a.opBinary is 
a different construct from the second a.opBinary.

>> 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

I didn't claim it was intentional. In fact, I suspect it is an 
implementation bug since nothing except the implementation hints that it 
should not work.

> and it would be harder to implement the feature than to keep
> things as they stand (according to discussions on bugzilla).
>

I wouldn't know about the DMD code base.

>> 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).
>

I am abstracting their essence. If you think there was any argument that 
does not fit the above description, feel free to bring it up.

>>> 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).
>

I am flattered you went through the hassle of searching the forums in 
order to build an irrelevant ad hominem argument.
Note however, that the thread quoted contains justification for every 
opinion I have posted.
On a general note, NG conversations are not linear and there may be race 
conditions.


More information about the Digitalmars-d mailing list