www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 809] New: lazy argument convert to delegate

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=809

           Summary: lazy argument convert to delegate
           Product: D
           Version: 1.00
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: cpunion gmail.com


void test(lazy int dg){
        int delegate() dg_ = dg;
}

Compile error:
$ dmd -c t.d
t.d(2): Error: cannot implicitly convert expression ((dg)()) of type int to int
delegate()


-- 
Jan 07 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=809


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





I don't really think it should (and it isn't documented to work). I suspect
enhancing D to make this work would lead to problems down the road. I'd rather
leave it as an error.


-- 
Feb 02 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=809


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com





How about defining &dg to extract the delegate?


-- 
Mar 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=809


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |
            Summary|lazy argument can't convert |Should be possible to
                   |to delegate                 |convert lazy argument to
                   |                            |delegate





Reopening per no response to my last comment.


-- 
Dec 08 2008