DIP69: problem with scope grammar - need a new keyword
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 8 02:52:52 PST 2014
On 12/8/2014 2:44 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> On Monday, 8 December 2014 at 10:37:29 UTC, Walter Bright wrote:
>> Another problem with that is:
>>
>> void func(scope T delegate() dg);
>
> Playing the devil's advocate:
>
> void func(scope(T delegate()) dg);
> void func(scope(T) delegate() dg);
Note that:
void func(ref T delegate() dg);
has the same problem. The only way to make dg return a 'ref T' is to use an alias:
alias ref T delegate() dg_t;
void func(dg_t dg);
or put 'ref' as a postfix:
void func(T delegate() ref dg);
But if the latter solution is used for 'scope', then it interferes with 'scope
this'.
More information about the Digitalmars-d
mailing list