Disappointing inflexibility of argument passing in D
Carl Sturtivant
sturtivant at gmail.com
Tue Feb 11 08:28:59 PST 2014
On Tuesday, 11 February 2014 at 15:57:33 UTC, Tobias Pankrath
wrote:
> On Tuesday, 11 February 2014 at 15:10:57 UTC, Carl Sturtivant
> wrote:
>> void main() {
>> //conversions from string part of the definitions of
>> Data, Data2
>> f( "hello", "bonjour"); //no way to do this ---
>> disappointing
>> }
>>
>> See
>> http://forum.dlang.org/thread/agstjpezerwlgdhphclk@forum.dlang.org
>
> Function calls are a more complicated case because of overload
> resolution.
>
> If f(string, string) is defined, this will a) break silently or
> b) require qualification. Both is disappointing, too.
I do not understand why your (a) and (b) provably must be so.
Please supply an argument: there seem to be other possibilities
and without a proof that there are not, we may as well seek to do
the right thing.
In the absence of such comprehension on my part, it seems to me
that what's needed are some consistent rules that generalize the
overloading rules about the interaction of opPass and
overloading, with some priorities so that the best match is
found. Perhaps some combinations of opPass and overloading should
be illegal. Not that I've thought this through. :)
But is there a good reason why there isn't a reasonable such set
of rules in principle? And if not, why do we not have opPass?
Overtly converting all over the place is less than a happy
situation.
More information about the Digitalmars-d
mailing list