inout and function/delegate parameters

Stewart Gordon smjg_1998 at yahoo.com
Fri Mar 9 16:44:20 PST 2012


On 19/02/2012 14:27, Stewart Gordon wrote:
<snip>
> int opApply(int delegate(ref inout(T)) dg) inout;
>
> But then I realised a potential ambiguity:
> (a) the constancy is passed through to the delegate
> (b) the delegate has an inout parameter in its own right
<snip>

Thinking about it, if we go with (a), then (b) can be achieved by defining an alias of the 
delegate type.  Just one problem I can see: since a signature that uses (b) can't be 
represented in code without an alias, how would compiler messages, .stringof and TypeInfo 
notate the type?

But if we go with (b), then there doesn't seem to be a way to achieve (a) without 
inventing new syntax.

Stewart.


More information about the Digitalmars-d mailing list