🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #979

Does Modula-2 have operator overloading?

#979
From: Cy Foughty
Date: Wed, 25 Jul 1990 18:31
29 lines
1041 bytes
The subject says it all. The operator overloading I would like to
see is like that of (Gasp) C++. In that NEWLY created data types can have
the operations for "+", "-", etc. defined in the implementation module.
Example:

TYPE 
	String = ARRAY[1..1000] OF CHAR ;

(* Implementation code here*)

Then in application code:

VAR
	str1 	: String ;
	str2	: String ;
	str3	: String ;

	str1 := "This is" ;
	str2 := " a test" ;

	str3 := str1 + str2 ;

"str3" would then contain "This is a test".

-- 
Cy Foughty
DSC Communications, Inc. 1000 Coit Rd., Plano,TX 75075
Work:214.519.4237 La Casa:214.578.8837
Don't compromise your compromises.
Technical Details
Message-ID: <824@digi.lonestar.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!sun-barr!newstop!texsun!digi.lonestar.org!cfoughty

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!sun-barr!newstop!texsun!digi.lonestar.org!cfoughty
From: cfoughty@digi.lonestar.org (Cy Foughty)
Newsgroups: comp.lang.modula2
Subject: Does Modula-2 have operator overloading?
Message-ID: <824@digi.lonestar.org>
Date: 25 Jul 90 18:31:35 GMT
Organization: DSC Communications, Plano Tx.
Lines: 29