@safe inference fundamentally broken

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 5 13:32:24 PDT 2014


On Thursday, 5 June 2014 at 19:57:08 UTC, Steven Schveighoffer 
wrote:
> A possible fix could be to reject the call to ptr at runtime if 
> the slice is empty.

I don't know why you'd ever do "arr.ptr" in the first place, 
other than to avoid the bounds check. So I think the call should 
just be unsafe, and we call it a day. Or maybe to interface with 
a function that want a pointer?

"Maybe", we could get away with allowing "&arr[someIndex]" 
though. The compiler would have to be able to "understand" this 
is not escaping a reference (for *DYNAMIC* arrays anyways).


More information about the Digitalmars-d mailing list