DIP30, delegates more destruction for your pleasure
Maxim Fomin
maxim at maxim-fomin.ru
Wed Mar 13 22:12:50 PDT 2013
On Thursday, 14 March 2013 at 03:12:21 UTC, deadalnix wrote:
>> From " UFCS as delegates": example with function foo(ref uint
>> a) raises concern about ABI implementation. Currently context
>> pointer is passed through RDI and arguments are passed
>> differently. There would be a problem with functions like
>> foo() which do not know from where to take an argument - are
>> they called directly or like a closure?
>>
>
> I don't think ABI should be part of D spec. Or should it ?
>
> Anyway, I don't see any reason to have all kind of different
> ABI for function call, and this is a good opportunity to unify
> everything using the context as a regular, first argument.
ABI, at least partly, is and should be part of the spec.
Otherwise it has some of the C++ problems. And the point was not
about ABI in a sense of adding piece of information to chapter in
dlang.org, but about implementing compiler. I am not enthusiastic
about most DIPs presented recently because 1) without Walter and
Andrei approval 2) without somebody willing to implement it, DIP
turns to be a paper intellect exercise and corresponding ideas
defence in the forum.
>> Frankly, I see this simpler: delegate = function pointer +
>> data pointer, so they should follow language rules (especially
>> regarding qualifiers).
>>
>
> It is a tempting idea, but do not work. Consider :
>
> void delegate() immutable a;
> const void delegate() b = a;
>
> This would be forbidden as covariance of function parameters
> and transitivity act in opposite directions.
The problem is that there is 1 qualifier in current syntax and
two underlying objects.
More information about the Digitalmars-d
mailing list