March 26, 2017
What's the difference between
1.
string x = "abcd";
    foreach(character; x)
        write(character);

and

string x = "abcd";
    foreach(character; x[0..$])
        write(character);

2. is and ==

3. pointer and address and reference?
March 26, 2017
On 26/03/2017 7:52 AM, helxi wrote:
> What's the difference between
> 1.
> string x = "abcd";
>     foreach(character; x)
>         write(character);
>
> and
>
> string x = "abcd";
>     foreach(character; x[0..$])
>         write(character);

Hopefully the compiler is smart enough to ignore that slice (since its identical in purpose).

> 2. is and ==

is: bit for bit comparison
==: "magic" comparison logic, supports e.g. opEquals on classes.

> 3. pointer and address and reference?

pointer: a place in memory! or hdd.. or well pretty much anywhere the kernel maps it to, just assume that there is some data there that you may be able to do some, all or none of these things read, write, execute. May also be invalid aka null aka 0.

reference: pointer + some other pointer generally, e.g. class instance data pointer + typeinfo reference + vtable.