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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 19 15:36:55 PDT 2014


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #4 from monarchdodra at gmail.com 2014-03-19 15:36:51 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > to!(int[])(a) should take care of that.
> 
> There are also const casts:
> 
> array(cast(int[])a1)
> 
> But the design point of array() is to digest anything you may iterate, and
> produce a dynamic array. So I think array(immutable(int)[]) should not require
> casts or to!().

In this case, "is(immutable(int) : int)" is true, but this is not true of all
types, so array won't be able to do this for any and all types.

That said, it doesn't seem ridiculous to me either:
1) Create an array of whatever an IFTI on the element type would produce.
2) Simply make mutable elements for types that can safely be converted to their
Unqual type.

However, this would be a change of behavior, which may or may not be an
improvement, and may or may not break code.

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