Discussion Thread: DIP 1032--Function pointers and Delegate Parameters...--Community Review Round 1
    H. S. Teoh 
    hsteoh at quickfur.ath.cx
       
    Sat Apr 11 01:13:57 UTC 2020
    
    
  
On Fri, Apr 10, 2020 at 05:05:45PM -0700, Walter Bright via Digitalmars-d wrote:
> On 4/10/2020 5:22 AM, Steven Schveighoffer wrote:
> > No, you don't "make" foo pure, it is specifically marked pure.
> > 
> > In other words, you have:
> > 
> > void foo(void delegate() @called) pure @nogc @safe { dg(); }
> > 
> > So the @called attribute says "foo calls dg", which means that for a
> > specific call of foo, you can strip off attributes that it doesn't
> > have.
> 
> Sorry, that's still another way of saying the same thing - foo()'s
> implementation has to be pure-compatible. This is impractical for
> reasons mentioned.
And since we appear to be talking past each other, let me enumerate
exactly what we mean:
Case 1:	body of foo is pure, dg is impure.  Result: foo(dg) is impure.
Case 2: body of foo is pure, dg is pure. Result: foo(dg) is pure.
Case 3: body of foo is impure, dg is impure.  Result: foo(dg) is impure.
Case 4: body of foo is impure, dg is pure. Result: foo(dg) is impure.
There is no requirement placed upon foo besides what its author has
already imposed upon it.
T
-- 
Be in denial for long enough, and one day you'll deny yourself of things you wish you hadn't.
    
    
More information about the Digitalmars-d
mailing list