UFCS for struct opCall?
Maxim Fomin
maxim at maxim-fomin.ru
Wed Apr 10 05:59:24 PDT 2013
On Tuesday, 9 April 2013 at 19:08:51 UTC, Timon Gehr wrote:
> 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.
a) UFCS and overloading are distinct topics. One does not enforce
other to work in a particular way. For example, UFCS does not
mean that a.typeid should be rewritten as typeid(a) or foo!int
can be written as int.foo. Judging by enhancement requests in
bugzilla, there is trend for asking anything like 'a..b..c' to
be writable as 'a.b...c' in general. None of such ideas is 100%
right per se, including operator overloading.
b) UFCSing operator overloading is a feature which can be easily
and likely to broken. By easily broken I mean that despite the
idea looks 'cool', its advantages evaporate when there are
multiple opBinaries and other stuff. It is possible to rewrite
conflicting function name to other and use it, but it isn't
possible to rewrite conflicting basic expression in terms of
other basic expressions. There is no possibility for
S[my.bar.mod.opCall](). The idea blows up and you have to use
function call as currently. By likely to be broken I mean higher
probability to run in name conflict with operators than with
regular methods (and it would happen very likely because idea
seems to be popular).
By the way, not all operators can be overloaded because "...
These operators [comma, ternary, && and || ] were considered to
create more confusion than flexibility if ever overloaded..."
which does not necessarily means that this decision is
"incomplete" and "non sequitur".
>>>> 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.
I don't care of flattering you, but I do not like when arguments
are distorted or described as being absent, or people are
portrayed as having no idea what they are talking about.
Surely, I do understand advantages of the idea and understand why
the idea is considered to be logical, I object not because being
programming sadist, but because consider idea harmful and easy to
abuse.
More information about the Digitalmars-d
mailing list