www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7457] New: nested pure functions not specified


           Summary: nested pure functions not specified
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: timon.gehr gmx.ch

I think the following behavior of DMD is not mirrored in the documentation.

void main(){
    int x;
    void foo()pure{x=2;} // error

I think the spec is right, making this an error is problematic:

int bar(int delegate()pure dg)pure{return dg();}

int foo(int x)pure{
    return bar({return x+1;});// error

struct Delegate{
    int function(int*)pure fun;
    int* context;
    int call()pure{return fun(context);}

int bar2(Delegate dg)pure{return dg.call();}

int foo2(int x)pure{
    return bar2(Delegate(function(int* ptr){return *ptr+1;}, &x)); // fine      

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2012