Overloading relational operators separately; thoughts?

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 30 23:54:56 PDT 2016


On Fri, 2016-09-30 at 23:31 +0000, Sai via Digitalmars-d wrote:

> Genuine question: In the post Java languages, how many languages 
> allowed unrestricted operator overloading and did that cause any 
> similar mess?

It is not feasible to provide a count, as there is always another
language one forgot.

Groovy, Kotlin, Ceylon, and Scala certainly allow operator overloading.
Scala even allows new operator symbol definition. There are some
incomprehensible Scala programs because of this. But then there are
many incomprehensible D programs – you can play code golf in any
language. Just because there is a feature in a language doesn't mean it
has to be abused.

I cannot remember offhand whether Fantom, Golo, Gosu, etc. allow
operator overloading.

The core lesson of Python is that if you allow everything to happen,
there can still be a base of excellent code. Paternalism/maternalism in
programming languages is massively overrated. Youngsters will escape
the constraints. In the case of D operator overloading restrictions to
the glories (!) that is C++.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20161001/0d2e3222/attachment.sig>


More information about the Digitalmars-d mailing list