🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2963

Re: Variable types

#2963
From: jad1002
Date: Fri, 27 Oct 1995 23:40
31 lines
1400 bytes
In article <46q6dp$dcv@macondo.dmu.ac.uk> c2bs@dmu.ac.uk (Bimal Shah) writes:
>From: c2bs@dmu.ac.uk (Bimal Shah)
>Subject: Variable types
>Date: 27 Oct 1995 08:48:57 GMT

>Hi,

>In Modula-2, is it possible to call a procedure which
>has paramenters of AnyType ? e.g

>PROCEDURE AddOne(VAR number:AnyType);
>(* code here *)
>END AddOne;

It can be done... but the whole point of strong typing is that it shouldn't be 
done unless it's unavoidable. 
 
>I require this, as the same operations need to be carried
>out on different types... and i'd rather not have x procedures
>for x different types.. as this looks really messy.

If you really do have x different types then the operations on them are 
different, so you're overloading a procedure name by asking it to act as
a shortcut to what are actually different operations.

>Thankyou.
>|                 [Bimal Shah]                       |

Sorry to impose my own discipline on you ;)

James.
Technical Details
Message-ID: <jad1002.127.0017AE04@hermes.cam.ac.uk>
Path: arc1-ca.pugleaf.net!khonsu.trin.cam.ac.uk!jad1002
References: <46q6dp$dcv@macondo.dmu.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!khonsu.trin.cam.ac.uk!jad1002
From: jad1002@hermes.cam.ac.uk
Newsgroups: comp.lang.modula2
Subject: Re: Variable types
Date: Fri, 27 Oct 1995 23:40:37
Organization: Trinity College, Cambridge
Distribution: world
Message-ID: <jad1002.127.0017AE04@hermes.cam.ac.uk>
References: <46q6dp$dcv@macondo.dmu.ac.uk>
NNTP-Posting-Host: khonsu.trin.cam.ac.uk
X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]