Yet another leak in the sinking ship of @safe

Era Scarecrow via Digitalmars-d digitalmars-d at puremagic.com
Thu Feb 18 11:17:27 PST 2016


On Thursday, 18 February 2016 at 18:41:25 UTC, Steven 
Schveighoffer wrote:
> On 2/18/16 1:30 PM, Timon Gehr wrote:
>> No problem here. There is no way to assign to a void[] without 
>> doing 2.
>
> foo(void[] arr)
> {
>    void[] arr2 = [1234, 5678, 91011];
>    arr[] = arr2[0 .. arr.length];
> }

  Since void throws away type information (and all the safety 
related to it), would it be easier to simply require @safe code 
can't cast implicitly to void? It seems like explicit casting 
would take care of most of this, or disallowing to/from void 
converting period while in @safe code.

  To be honest, I think there's only 1 time I actually used a 
void[] in my code, and that was while writing a section in the 
BitArray replacement code years back in the case you wanted to 
use/read another block of data as the source for the BitArray. 
Beyond that I never touched it.


More information about the Digitalmars-d mailing list