Summary: relax inout rules
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-12-13 11:28:26 PST ---
Currently, DMD requires that the return type of a function that has
inout-qualified parameters is itself qualified with inout. Removing this
restriction would make the type system more expressive.

For example, the following function still requires code duplication to work for
multiple differently qualified parameters:

void copy(int** tgt, int* src){ *tgt = src; }
void copy(immutable(int)** tgt, immutable(int)* src){ *tgt = src; }
void copy(const(int)** tgt, const(int)* src){ *tgt = src; }

With the lifted restriction, these three overloads can be merged:

void copy(inout(int)** tgt, inout(int)* src){ *tgt = src; }

Also see the newsgroup discussion on the topic:

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to