[Issue 7105] New: relax inout rules
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 13 11:28:29 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=7105
Summary: relax inout rules
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 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:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=151839
--
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