🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c++
Article #111

Re: Wish List (new operators)

#111
From: Doug Moen
Date: Tue, 25 Mar 1986 16:33
33 lines
1760 bytes
>>As long as we're adding amenities to the language, I have a small wish...
>>
>>All the binary operators in C have a "please modify" form:
>>
>>	i = i + 3;   -->   i += 3;

>While we're at it, why not make *ALL* the binary operators have a "please
>modify" form: && and || do not  (at least not in any compiler I've used).


The 'please modify' forms of the unary operators could be written as:
	-= a;	==>	a = -a;
	~= a;	==>	a = ~a;
	!= a;	==>	a = !a;
I think this is upward compatible with existing C programs.


As for making *all* of the binary operators have a 'please modify' form:
I think we run into problems with the relational operators:
	a === b;	==>	a = a == b;	/* no problem */
	a <= b;		==>	a = a < b;	/* this won't work */


And there are definite problems with overloading '.' and '->':
	a.b
could be interpreted either as referencing member 'b' from struct 'a',
or as a function call:
	operator.(a, b)
Both of these interpretations could be valid if both a member 'b' and a
variable 'b' are defined.
-- 
Doug Moen (watmath!watcgl!kdmoen)
University of Waterloo Computer Graphics Lab
Technical Details
Message-ID: <516@watcgl.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!watnot!watcgl!kdmoen
References: <429@batcomputer.TN.CORNELL.EDU> <47900005@ccvaxa>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site watcgl.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!watnot!watcgl!kdmoen
From: kdmoen@watcgl.UUCP (Doug Moen)
Newsgroups: net.lang.c++
Subject: Re: Wish List (new operators)
Message-ID: <516@watcgl.UUCP>
Date: Tue, 25-Mar-86 11:33:27 EST
Article-I.D.: watcgl.516
Posted: Tue Mar 25 11:33:27 1986
Date-Received: Wed, 26-Mar-86 03:09:41 EST
References: <429@batcomputer.TN.CORNELL.EDU> <47900005@ccvaxa>
Reply-To: kdmoen@watcgl.UUCP (Doug Moen)
Organization: U of Waterloo, Ontario
Lines: 33
Summary: silly intellectual exercise