Operators overloading in D2

div0 div0 at users.sourceforge.net
Sat Apr 24 02:48:54 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan wrote:
> Hi All,
> So there's my questions
> Why D2 changed in this way the operators overloading?
> I saw the the compiler compiles both the functions, even considering this I assume it's not safe to use the old D1 way,
> right?

Because Walter got fed up with trying to come up with the bazillon
different names you need for all the operators.

Don't forget you need the array operators (eg  a[] += 5,
opArrayAddAssign?!) as well as the the slicing ops (eg a[0..5] += 5,
opSliceArrayAddAssign?!) which means doubling/trebling the number of old
style names. Just gets sucky.

And who knows how many other operators might wind up being needed.

I didn't like it at first glance either but I've changed my mind.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFL0r6GT9LetA9XoXwRAuWCAJ9i+oEf1Dgk1Tn1WJ7vcjvOM0+oPwCfZNgu
m+ILQWOCPfvoRQseqcd9CyA=
=mmsY
-----END PGP SIGNATURE-----


More information about the Digitalmars-d-learn mailing list