www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9251] New: An immutable arrays concatenation to produce an immutable implicitly castable to mutable?

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Jan 01 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9251


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from yebblies <yebblies gmail.com> 2013-01-05 18:32:00 EST ---
*** This issue has been marked as a duplicate of issue 1654 ***

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