On Mon, 03 Nov 2014 09:50:26 -0500 Steven Schveighoffer via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> There is a reason we get at least 1 question a week on how D arrays work. and this is a clear sign that something is *very* wrong with them. i fully understand the mechanics behind dynamic arrays, slicing and so on. what i *can't* understand here is why compiler allowing me to shoot my foot even without a warning. compiler *knows* that this is dynamic array. it *knows* that assign is impure (as saveIt() obviously not "pure" and it can't be). yet it silently allows me do that. it's *very* error-prone code. it's easy for compiler to reject such code (or at least warn me). but it choses to carefully hide the possible bug. i'm nat talking about "it must work as i expect!" here. what i'm talking about is that D compiler allows potentialy unsafe and error-prone code. it's ok for pointers, i'm walking in dangerous area with pointers, but it's not ok when i using *built-in* *type*! it's like "ahahaha, let's see how smart you are! i will not warn you about problematic code (despite i can do that without big problems) and we'll see how fast you'll find that gotcha!" it's very funny to read discussions about safety and environment variables here. they were boring before, but now i realised the sarcasm, and they becomes very amusing.
signature.asc
Description: PGP signature