🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Mike Linnig Fri, 31 Oct 1986 14:25
Overloading "and"
#1042
Author: Mike Linnig
Date: Fri, 31 Oct 1986 14:25
33 lines
1440 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads