<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>bleh, that's junk. You can't do a const-cast on tail-const stuff?</span></div><div><br><span></span></div><div><span>How is that supposed to work, do this?</span></div><div><br><span></span></div><div><span>cast()[] </span></div><div><br><span></span></div><div><span>that doesn't work either. Sorry Daniel, I guess I was wrong. Or is it the compiler which is wrong? It seems I should be able to do a const cast to remove const, seeing as how I can do:</span></div><div><br><span></span></div><div><span>struct S</span></div><div><span>{</span></div><div><span> dchar[] d;<br></span></div><div><span>}</span></div><div><br><span></span></div><div><span>const(S) s;</span></div><div><br><span></span></div><div><span>S s2 = cast()s;</span></div><div><br></div><div>I guess the correct thing to do now
is switch it back to the way you were going to do it, then file a bug on how crappy cast() is.</div><div><br></div><div>For those of you wondering about the context, the fix was to cast a dstring to dchar[]:</div><div><br></div><div>dchar[] d = cast(dchar[])toUTF32(s);<br></div><div><br></div><div>so it could be sorted. I suggested using cast(), since this doesn't risk changing the array type, just the constancy. But apparently cast() does nothing to tail-const or tail-immutable arrays.</div><div><br></div><div>-Steve<br></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Brad Roberts <braddr@puremagic.com><br><b><span
style="font-weight: bold;">To:</span></b> D's runtime library developers list <d-runtime@puremagic.com><br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, July 12, 2011 1:00 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [D-runtime] [D-Programming-Language/druntime] 850eaa: Do not sort arrays of immutable elements, use a ca...<br></font><br>Yay.. first post-release checkin, and the build breakage is in full swing. <br>:)<br><br>On Tue, 12 Jul 2011, <a ymailto="mailto:noreply@github.com" href="mailto:noreply@github.com">noreply@github.com</a> wrote:<br><br>> Date: Tue, 12 Jul 2011 06:24:47 -0700<br>> From: <a ymailto="mailto:noreply@github.com" href="mailto:noreply@github.com">noreply@github.com</a><br>> Reply-To: D's runtime library developers list <<a ymailto="mailto:d-runtime@puremagic.com" href="mailto:d-runtime@puremagic.com">d-runtime@puremagic.com</a>><br>> To: <a
ymailto="mailto:d-runtime@puremagic.com" href="mailto:d-runtime@puremagic.com">d-runtime@puremagic.com</a><br>> Subject: [D-runtime] [D-Programming-Language/druntime] 850eaa: Do not sort<br>> arrays of immutable elements, use a ca...<br>> <br>> Branch: refs/heads/master<br>> Home: <a href="https://github.com/D-Programming-Language/druntime" target="_blank">https://github.com/D-Programming-Language/druntime</a><br>> <br>> Commit: 850eaa6e06fc323ee8bd964f9c15be7ae1b02699<br>> <a href="https://github.com/D-Programming-Language/druntime/commit/850eaa6e06fc323ee8bd964f9c15be7ae1b02699" target="_blank">https://github.com/D-Programming-Language/druntime/commit/850eaa6e06fc323ee8bd964f9c15be7ae1b02699</a><br>> Author: Daniel Murphy <<a ymailto="mailto:yebblies@gmail.com" href="mailto:yebblies@gmail.com">yebblies@gmail.com</a>><br>> Date:
2011-07-12 (Tue, 12 Jul 2011)<br>> <br>> Changed paths:<br>> M src/rt/adi.d<br>> <br>> Log Message:<br>> -----------<br>> Do not sort arrays of immutable elements, use a cast instead to prevent a performance penalty.<br>> <br>> <br>> Commit: 54c5c78a60f1e6ee00fb53019eb3deaaed65ae39<br>> <a href="https://github.com/D-Programming-Language/druntime/commit/54c5c78a60f1e6ee00fb53019eb3deaaed65ae39" target="_blank">https://github.com/D-Programming-Language/druntime/commit/54c5c78a60f1e6ee00fb53019eb3deaaed65ae39</a><br>> Author: Steven Schveighoffer <<a ymailto="mailto:schveiguy@yahoo.com" href="mailto:schveiguy@yahoo.com">schveiguy@yahoo.com</a>><br>> Date: 2011-07-12 (Tue, 12 Jul 2011)<br>> <br>> Changed paths:<br>> M src/rt/adi.d<br>> <br>> Log Message:<br>>
-----------<br>> Merge pull request #37 from yebblies/issue1339<br>> <br>> Do not sort arrays of immutable elements<br>> <br>> <br>> Compare: <a href="https://github.com/D-Programming-Language/druntime/compare/eb8246c...54c5c78" target="_blank">https://github.com/D-Programming-Language/druntime/compare/eb8246c...54c5c78</a><br>> _______________________________________________<br>> D-runtime mailing list<br>> <a ymailto="mailto:D-runtime@puremagic.com" href="mailto:D-runtime@puremagic.com">D-runtime@puremagic.com</a><br>> <a href="http://lists.puremagic.com/mailman/listinfo/d-runtime" target="_blank">http://lists.puremagic.com/mailman/listinfo/d-runtime</a><br>> <br>_______________________________________________<br>D-runtime mailing list<br><a ymailto="mailto:D-runtime@puremagic.com" href="mailto:D-runtime@puremagic.com">D-runtime@puremagic.com</a><br><a href="http://lists.puremagic.com/mailman/listinfo/d-runtime"
target="_blank">http://lists.puremagic.com/mailman/listinfo/d-runtime</a><br><br><br></div></div></blockquote></div></div></body></html>