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

           Summary: [enh] polymorphic lambda should be storeable in enum
                    constant
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: c...@dawg.eu


--- Comment #0 from Martin Nowak <c...@dawg.eu> 2013-01-29 16:02:07 PST ---
I don't see a compelling reason why we should disallow assigning polymorphic
lambdas to manifest constants.
This would allow the following code to work.

enum foo = bar => bar * 2;
foo(10);
foo!uint(10); // probably too

The equivalent template would be.
template foo(T) { auto foo(T bar) { return bar * 2; } }

This is for example very handy to replace C-style macros.

#define MASK(val) ((val) & 0xF)
vs.
enum MASK = val => val & 0xF;

related: Bug 7176, Bug 8452

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

Reply via email to