[Issue 3492] Can't overload nested functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 27 05:17:04 PST 2012


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


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr at gmx.ch


--- Comment #6 from timon.gehr at gmx.ch 2012-02-27 05:16:59 PST ---
(In reply to comment #4)
> The reason is straightforward - there's no point to it. Nested functions tend
> to be right next to where they are used. They're not off in a separate file.
> 
> We shouldn't have features just to have features.

But we do have overloading in the language already. We shouldn't just deny
access to existing features. Chances are that a compiler works better if there
are no arbitrary inconsistencies (see all the bugs related to parsing storage
classes of nested declarations for an example -- just define the language such
that reusing parsing procedures is easy.)

> They have to have an identifiable benefit. Overloaded functions introduce complexity both to the user and the compiler - and there is no clear benefit for nested functions.

What introduces complexity to the user and the compiler is that the syntax
(and, like in this case, even the semantics!) of function local declarations is
substantially different from global declarations and declarations inside
aggregates. It is not 'turtles all the way down', it is not consistent, and it
is not useful. Those are arbitrary limitations. I'd suspect that DMD can even
handle correctly most of the function local features that are currently invalid
syntax.

-- 
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