[D-runtime] [D-Programming-Language/druntime] 850eaa: Do not sort arrays of immutable elements, use a ca...

Steve Schveighoffer schveiguy at yahoo.com
Tue Jul 12 11:38:14 PDT 2011


bleh, that's junk.  You can't do a const-cast on tail-const stuff?

How is that supposed to work, do this?

cast()[] 

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:

struct S
{
   dchar[] d;

}

const(S) s;

S s2 = cast()s;

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.

For those of you wondering about the context, the fix was to cast a dstring to dchar[]:

dchar[] d = cast(dchar[])toUTF32(s);


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.

-Steve




>________________________________
>From: Brad Roberts <braddr at puremagic.com>
>To: D's runtime library developers list <d-runtime at puremagic.com>
>Sent: Tuesday, July 12, 2011 1:00 PM
>Subject: Re: [D-runtime] [D-Programming-Language/druntime] 850eaa: Do not sort arrays of immutable elements, use a ca...
>
>Yay.. first post-release checkin, and the build breakage is in full swing. 
>:)
>
>On Tue, 12 Jul 2011, noreply at github.com wrote:
>
>> Date: Tue, 12 Jul 2011 06:24:47 -0700
>> From: noreply at github.com
>> Reply-To: D's runtime library developers list <d-runtime at puremagic.com>
>> To: d-runtime at puremagic.com
>> Subject: [D-runtime] [D-Programming-Language/druntime] 850eaa: Do not sort
>>     arrays of immutable elements, use a ca...
>> 
>>   Branch: refs/heads/master
>>   Home:  https://github.com/D-Programming-Language/druntime
>> 
>>   Commit: 850eaa6e06fc323ee8bd964f9c15be7ae1b02699
>>      https://github.com/D-Programming-Language/druntime/commit/850eaa6e06fc323ee8bd964f9c15be7ae1b02699
>>   Author: Daniel Murphy <yebblies at gmail.com>
>>   Date:   2011-07-12 (Tue, 12 Jul 2011)
>> 
>>   Changed paths:
>>     M src/rt/adi.d
>> 
>>   Log Message:
>>   -----------
>>   Do not sort arrays of immutable elements, use a cast instead to prevent a performance penalty.
>> 
>> 
>>   Commit: 54c5c78a60f1e6ee00fb53019eb3deaaed65ae39
>>      https://github.com/D-Programming-Language/druntime/commit/54c5c78a60f1e6ee00fb53019eb3deaaed65ae39
>>   Author: Steven Schveighoffer <schveiguy at yahoo.com>
>>   Date:   2011-07-12 (Tue, 12 Jul 2011)
>> 
>>   Changed paths:
>>     M src/rt/adi.d
>> 
>>   Log Message:
>>   -----------
>>   Merge pull request #37 from yebblies/issue1339
>> 
>> Do not sort arrays of immutable elements
>> 
>> 
>> Compare: https://github.com/D-Programming-Language/druntime/compare/eb8246c...54c5c78
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>> 
>_______________________________________________
>D-runtime mailing list
>D-runtime at puremagic.com
>http://lists.puremagic.com/mailman/listinfo/d-runtime
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d-runtime/attachments/20110712/7d3b35d4/attachment.html>


More information about the D-runtime mailing list