Things that make writing a clean binding system more difficult

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 28 23:29:19 PDT 2016


On 29.07.2016 06:52, Jonathan M Davis via Digitalmars-d wrote:
> On Friday, July 29, 2016 06:44:16 Timon Gehr via Digitalmars-d wrote:
>> My parser accepts the following:
>>
>> int function(int,int)ref functionPointer;
>>
>> I wasn't really aware that this was illegal in DMD. (Other function
>> attributes, such as pure, are accepted.)
>>
>> In fact, even the following is disallowed:
>> int foo(int)ref{}
>>
>>
>> Should I file an enhancement request?
>
> Except that ref isn't a function attribute.

Yes it is.

int x;
ref{
     int foo(){ return x;}
}
pragma(msg, typeof(&foo()));


> It's an attribute on the return type.

There is no such thing. Types cannot have attributes.

> So, it doesn't make sense for it to be on the right. That would be
> like having the const on the right-hand side of a member function apply to
> the return type rather than the function itself.
> ...

You have it backwards.


More information about the Digitalmars-d mailing list