[Issue 7798] New: Improve nested functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 29 14:15:36 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7798

           Summary: Improve nested functions
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: siegelords_abode at yahoo.com


--- Comment #0 from siegelords_abode at yahoo.com 2012-03-29 14:16:04 PDT ---
I've run into two issues with nested functions that I think should be fixed. As
is, it seems that the nested functions are scarcely more than syntax sugar for
delegates.

1. Overloading:

void main()
{
    void test() {}
    void test(int a) {}
}

No good reason why that shouldn't work. This is described in the spec, but no
good reason is given.

2. Reusing same function name in different scopes:

void main()
{
    { void test() {} }
    { void test() {} }
}

This won't compile either. This limitation isn't even described in the spec as
far as I can tell.

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


More information about the Digitalmars-d-bugs mailing list