[Issue 5074] array(immutable(int)[]) ==> int[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 21 05:18:16 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=5074



--- Comment #8 from monarchdodra at gmail.com 2014-03-21 05:18:13 PDT ---
(In reply to comment #7)
> It doesn't have to!  If array is pure, takes some form of const(int)[], and
> returns int[] then the result will implicitly convert to immutable!

I had thought of that, but it could still break in subtle ways in regards to
inference. Instead of being immutable by default, you have to trigger the
conversion.

EG. break:
//---
immutable a = "hello;
auto      b = array(a); //is now an dchar[], not dstring :§

...

dstring c = b; //error!
//----

I *do* think it's very nice design though, and it *really* shows the strength
of pure functions. And there remember there being requests for things like
"specify the constness of array", so this change would also fix that.

But it would still be a breaking change. A good change (IMO), but still a
breaking one.

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


More information about the Digitalmars-d-bugs mailing list