On Saturday, 7 February 2015 at 01:55:27 UTC, Jonathan Marler
wrote:
Byte b;
b = 0;
b = 1;
b = 255;
b = -256;
b = 'a';
b = cast(const char)'a';
b = cast(immutable char)'a';
b = cast(byte)1;
b = cast(const byte)1;
b = cast(immutable byte)1;
b = cast(ubyte)1;
b = cast(const ubyte)1;
b = cast(immutable ubyte)1;
These are possible with opAssign (which should be accompanied
with corresponding constructor(s)).
Byte echo(Byte b)
{
return b;
}
b = echo('a');
b = echo(cast(const char)'a');
b = echo(cast(immutable char)'a');
b = echo(cast(byte)1);
b = echo(cast(const byte)1);
b = echo(cast(immutable byte)1);
b = echo(cast(ubyte)1);
b = echo(cast(const ubyte)1);
b = echo(cast(immutable ubyte)1);
Byte[] barr;
barr = "teststring";
barr = [0,1,2,3];
}
These are not possible as D does not support implicit
construction.