🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2024

Re: Op overloading/var. parms, (was BIX - BYTE - JPI - Chaos)

#2024
From: Bill Seurer
Date: Mon, 29 Apr 1991 13:37
24 lines
1514 bytes
Excerpts from netnews.comp.lang.modula2: 23-Apr-91 Op overloading/var.
parms, .. mdlcpgs@lhn.dsir.govt.nz (2819)

> I find
> 	a := b + c;
> much more reabable than
> 	AddComplex(a,b,c); 	{ so whats being added to what? }

I agree that overloaded operators can be nice.  However, they also can
be easily abused.  A popular one is to use + for string concatenation
"'cause it's just like you're adding the two strings together."  Well,
you aren't adding them you are concatenating them.  If "ab" + "cd" is
"abcd" then 123 + 456 must =be123456, right?  :-)

And as for complex numbers, if you have a good compiler that allows any
type to be returned as a function result then:

a := Complex.Add(b,c);

is much clearer than your example (though in this case still not as nice
as a:=b+c).

- Bill Seurer      IBM: seurer+@rchland  Prodigy: CNSX71A
  Rochester, MN    Internet: seurer+@rchland.vnet.ibm.com
Technical Details
Message-ID: <4c7263c91EAfQ1BW4G@rchland.ibm.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!panews!rchland.ibm.com!seurer+
References: <editor%ucf1vm.BITNET@LILAC.BERKELEY.EDU> <8015.280c0c0e@lhn.dsir.govt.nz> <1991Apr19.173651.9572@iitmax.iit.edu>, <8020.281425b4@lhn.dsir.govt.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!panews!rchland.ibm.com!seurer+
From: seurer+@rchland.ibm.com (Bill Seurer)
Newsgroups: comp.lang.modula2
Subject: Re: Op overloading/var. parms, (was BIX - BYTE - JPI - Chaos)
Message-ID: <4c7263c91EAfQ1BW4G@rchland.ibm.com>
Date: 29 Apr 91 13:37:07 GMT
References: <editor%ucf1vm.BITNET@LILAC.BERKELEY.EDU> <8015.280c0c0e@lhn.dsir.govt.nz> <1991Apr19.173651.9572@iitmax.iit.edu>,
 <8020.281425b4@lhn.dsir.govt.nz>
Organization: IBM Rochester, Mn
Lines: 24
In-Reply-To: <8020.281425b4@lhn.dsir.govt.nz>