DIP27 available for destruction

Timon Gehr timon.gehr at gmx.ch
Tue Feb 26 15:40:08 PST 2013


On 02/26/2013 10:14 PM, Dicebot wrote:
> On Tuesday, 26 February 2013 at 20:42:57 UTC, Timon Gehr wrote:
>> On 02/26/2013 06:09 PM, Dicebot wrote:
>>> I like overall approach and think it really should be rule of a thumb
>>> for designing D features - defining simple bullet-proof semantics and
>>> making conclusions from it.
>>> As opposed to syntax-based special case coverage.
>>> ...
>>
>> Like it or not, that is what a compiler does.
>
> Pardon me, how is compiler relevant here?

The DIP serves as specification for later compiler implementation. If it 
is not formal enough, the implementation may miss corner cases.

> Languages are designed for programmers in first place, not compilers.
>

Even if that was considered unequivocally true, it would not render 
language specification unnecessary.

>>> 2) If you want to prohibit functions having an address, you need a
>>> section explaining communication with C in details in regard to passing
>>> function pointers.
>>>
>>
>> That actually wouldn't change.
>
> Why? Functions does not have an address according to this DIP. How will
> you pass a callback to C code then, special case for "extern(C)"?

ReturnType function(ParameterTypes) is a C function pointer type in the 
ABI. That wouldn't change.

extern(C) int foo(int function() fun);

void main(){
     static int bar(int x){ return x+1; }
     foo(bar);          // ok
     foo((int x)=>x+2); // ok
}


More information about the Digitalmars-d mailing list