Combining Delegate and Functions

Christian Kamm kamm-incasoftware at removethis.de
Tue Jun 30 22:59:51 PDT 2009


BCS wrote:

> Hello Daniel,
> 
>> BCS wrote:
>> 
>>> here's a general version that should work but dosn't:
>>> 
>> The problem is that out and ref aren't types; they're storage classes,
>> and D's current metaprogramming system has no way of accessing these.
>> 
>> You CAN get at them with .stringof, but that's 100% undocumented and a
>> MASSIVE pain in the arse.  It also means you have to write horrible
>> parsing code every single time you want to wrap a function.
>> 
>> There *really* has to be a better way.
>> 
> 
> the really painful bit is that the tuple from is(T A == function) has the
> ref/out stuff in it as shown by the first static assert but it gets
> dropped when it's used as an argument list (as show my the second
> [identical!] assert).

This is one of my favorite issues. The bug list is here 
http://d.puremagic.com/issues/show_bug.cgi?id=3106 and an interesting recent 
development is that Andrei thinks this should work: 
http://d.puremagic.com/issues/show_bug.cgi?id=2913

Maybe it will if you make the parameter storage classes part of the type and 
define them to be ignored everywhere but in function parameter declarations?

Not pretty though.





More information about the Digitalmars-d mailing list