[Issue 9251] New: An immutable arrays concatenation to produce an immutable implicitly castable to mutable?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 1 08:47:31 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9251
Summary: An immutable arrays concatenation to produce an
immutable implicitly castable to mutable?
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
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-01-01 08:47:30 PST ---
void main() {
string s1 = "abc";
char[] s2 = s1 ~ s1;
}
DMD 2.061alpha gives:
test.d(3): Error: cannot implicitly convert expression (s1 ~ s1) of type string
to char[]
A concatenation allocates a new array, so I think it should be a strongly pure
operation. So maybe a string concatenation should return a string that's
implicitly castable to char[]. (While usually in D with purity you have mutable
things that are implicitly castable to immutable). Is this possible and safe?
--
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