Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Overloading "and"

1 view
Skip to first unread message

Mike Linnig

unread,
Oct 31, 1986, 9:25:00 AM10/31/86
to
Here's something that I thought was illegal.

We've all seen Ada programs that overloaded the standard operators
("+","-","*","/"). We've also seen people overload the concatination
operator "&". But I didn't think it was possible to overload the
"AND" and "OR" operators.

The following compiles without error on DEC Ada:

PACKAGE test is

function "and"(l,r: integer) return integer;

END test;
----------------------------------------------------------------------
WITH test; USE test;

PROCEDURE mytest IS

a, b,c : integer;

BEGIN
a := b AND c; -- a call to the function TEST."AND"
END mytest;
----------------------------------------------------------------------

Many thanks to Renzo Bianchi and Gary Smith of TI, Colorado Springs for
bringing this to my attention.

Live and learn.

-- Mike Linnig,
Texas Instruments

0 new messages