On Tue, 19 Aug 2014 23:58:57 +0000 Andrew Godfrey via Digitalmars-d <digitalmars-d@puremagic.com> wrote:
> In either case, we are "passing a reference by value". yes. but passing null class will not allow to call it's methods, and passing null array will. i.e. auto foo (MyClass a) { return a.length; } will crash if length is not a static method (and it can't be static) and foo is called like this: foo(null). but the same call will work for 'int[]'. so user can assume that 'int[]' is something similar to class, and it's perfectly ok to use int[] methods, and '~=' is just the overloaded method, which should change contents of passed dynarray. again, overloaded '~=' will work for class (more or less), but will inevitably fail (i.e. will not change passed arg) for dynarray. and it's clear that 'a = new MyClass()' creates new object. and it's not clear at all that 'a ~= 42' creates new object too. it's counterintuitive. that's why i think that we need new term.
signature.asc
Description: PGP signature