🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3360

Re: Variabel Parameters...

#3360
From: Graham Perkins
Date: Mon, 11 Mar 1996 12:15
28 lines
1784 bytes
cz@ecn.net.au wrote:
> 
>  I am wondering if it is possible, in m2, to have a procedure that can
> be called with an un-defined number of parameters, with un-defined
> types (defined ofcourse when the proc is called)

Nope.  That would be completely counter to the strong typing flavour of 
the whole language.  You may be able to get the effect you want, without
compromising safety, using a single parameter and the array, record, or
set constructors.  But you'd need an ISO compliant compiler.  Otherwise,
use an open array.

> ... i.e for use with
> porting the printf() function in C over to modula-2...

One of the great advantages of printf() in C is that ordinary compilation
will not detect mismatch in number of format descriptors in format string
and number of subsequent parameters.  Another great advantage is that
the types of the subsequent strings do not have to match the types in 
the descriptors.

These features of variable, untyped parameter lists give the programmer
huge flexibility in creating a variety of runtime errors.
-- 
person: Graham Perkins         paper: School of Computing
voice:  +44 (0)1908 834936            De Montfort University
dots:   +44 (0)1908 834948            Milton Keynes MK7 6HP
bits:   grp@dmu.ac.uk                 United Kingdom
Technical Details
Message-ID: <31441962.4356@dmu.ac.uk>
Path: arc1-ca.pugleaf.net!yama.mcc.ac.uk!dmu!usenet
References: <4hodo7$flm@sydney1.world.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!yama.mcc.ac.uk!dmu!usenet
From: Graham Perkins <grp@dmu.ac.uk>
Newsgroups: comp.lang.modula2
Subject: Re: Variabel Parameters...
Date: Mon, 11 Mar 1996 12:15:30 +0000
Organization: De Montfort University
Message-ID: <31441962.4356@dmu.ac.uk>
References: <4hodo7$flm@sydney1.world.net>
NNTP-Posting-Host: mkcsst22.mk.dmu.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (Win16; I)