Topic: New operators for C++


Author: brendan@us-es.sel.de (Dalton)
Date: 8 Jul 92 17:11:46 GMT
Raw View
Apropos JOHN (MAX) SKALLER's "Yet Another Proposed Extension (YAPE) to C++."

What about allowing `//', `/*', `*/' and ` ' to be overloaded as well?

This would allow comments to do something useful, and
ensure that code fails when the comments aren't kept
up-to-date.

--
Brendan J. Dalton (brendan@us-es.sel.de)
----------------------------------------




Author: jack@solucor.uucp (Jacques Gelinas)
Date: 10 Jul 92 00:32:44 GMT
Raw View
brendan@us-es.sel.de (Dalton) writes:


>Apropos JOHN (MAX) SKALLER's "Yet Another Proposed Extension (YAPE) to C++."

>What about allowing `//', `/*', `*/' and ` ' to be overloaded as well?

>This would allow comments to do something useful, and
>ensure that code fails when the comments aren't kept
>up-to-date.

Few years ago, I have read about a system call ANA (annotated ADA). It
was a formal extension to ADA using comments. In those comments
you were allowed to specify differenting limits and expected behavior
of a software component. I see this as an outgrow of assert().

On the other hand overloading // is ... fun. I suggest a new lexical
convention. ::// could be used to express real comments.

New lexical ? Well if // is an operator, I suppose my extension
is a syntactic extension :-)

Sorry for the bandwidth ... !

--

--------------------------------------------------------
Jacques Gelinas (jack@solucor.uucp)
Today it's my opinion




Author: maxtal@extro.ucc.su.OZ.AU (John (MAX) Skaller)
Date: Tue, 30 Jun 1992 18:31:08 GMT
Raw View
This is Yet Another Proposed Extension (YAPE) to C++.

1) For each operator 'op' in C++ (to be qualified later),
the operator

 \op

will also be provided. It will have the same precedence and associativity,
but will be undefined. It can be overloaded, including for non-class
arguments.

2) The form
  \letters
where letters is a sequence of A-Z,a-z will be available
as a binary operator with the  same precedence and associativity
as +.

Both extensions are trivial to implement. Neither breaks any
existing code. The biggest disadvantage is that the hitherto
unused character backslash (\) is now part of the language.

The use of backslash suggests typesetting using TeX, allowing
a very rich set of operators to be available.

Example set-expression:

 A \cup B \cap C \subseteq D

C++ equivalent:

 A | B & C <= D

(which, in this case, is not so bad)

--
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
 Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------