[Issue 10491] New: Type inference for function arguments with default value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 27 18:05:54 PDT 2013


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

           Summary: Type inference for function arguments with default
                    value
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-06-27 18:05:52 PDT ---
Sometimes I have code like this:

struct VeryLongNamedStruct {}
void foo(in VeryLongNamedStruct x = VeryLongNamedStruct(1)) {}
void main() {}

Or even:

void bar(in TupleFoo x = TupleFoo(TupleBar(2), TupleSpam(3))) {}

In those cases something I'd like to use "auto" in the function signature for
the arguments that have a default value:

void foo(in auto x = VeryLongNamedStruct(1)) {}

A bit more complex case:

void spam(T)(const x = Foo!T(4)) {}

This is not an important new enhancement request (not all enhancement requests
have the same importance level), it doesn't allow to do new things, and its
priority is low, but (assuming it's not too much work to implement) I think
it's a handy small feature. It acts similarly to normal variable definitions,
so I think there is nothing much new to learn for D programmers.

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