[Issue 7312] New: const should be abstract

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 18 11:03:11 PST 2012


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

           Summary: const should be abstract
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at gmx.ch 2012-01-18 11:03:10 PST ---
const only has a meaning in presence of aliasing. Unique const data is
meaningless. const is abstract. strongly pure functions should not be allowed
to return const; they can return mutable or immutable data instead.

static assert(!is(typeof(new const(Object))));
static assert(!is(typeof(new const(int)[1])));
static assert(!is(typeof({const(Object) foo(){return new Object;}})));
static assert(!is(typeof({const(int)[] foo(){return new int[1];}})));

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