🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2000

Re: Overloading?

#2000
From: Warwick Allison
Date: Wed, 24 Apr 1991 06:40
24 lines
1075 bytes
>Today, I was trying to implement a fixed-point math module in M2,
>containing routines like Add, Sub, Mul, Div, etc. Using these routines
>really clutters your source with statements like:

>  a := Add(Mul(b,c),d);

>instead of the more readable:

>  a := b*c+d;

If you have

TYPE	FIXED=INTEGER;

then + and - work fine, so you don't need Add & Sub, but Mul and Div
require shifting.

Pity Modula-2 doesn't have Ada-like facilities for infix operators.
Warwick.
--
  _-_|\       warwick@cs.uq.oz.au
 /     *  <-- Computer Science Department,
 \_.-._/      University of Queensland,
      v       Brisbane, AUSTRALIA.
Technical Details
Message-ID: <960@uqcspe.cs.uq.oz.au>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!munnari.oz.au!brolga!uqcspe!cs.uq.oz.au!warwick
References: <209.2812FBE7@puddle.fidonet.org>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!munnari.oz.au!brolga!uqcspe!cs.uq.oz.au!warwick
From: warwick@cs.uq.oz.au (Warwick Allison)
Newsgroups: comp.lang.modula2
Subject: Re: Overloading?
Message-ID: <960@uqcspe.cs.uq.oz.au>
Date: 24 Apr 91 06:40:16 GMT
References: <209.2812FBE7@puddle.fidonet.org>
Sender: news@cs.uq.oz.au
Reply-To: warwick@cs.uq.oz.au
Lines: 24