Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!csnet-relay.arpa!cdshaw%watdragon%waterloo.CSNET From: cdshaw%watdragon%waterloo.CSNET@CSNET-RELAY.ARPA (Chris Shaw) Newsgroups: net.lang.mod2 Subject: Re: IO (Re: Overloading) Message-ID: <8603130302.AA24244@watdragon.UUCP> Date: Wed, 12-Mar-86 22:02:26 EST Article-I.D.: watdrago.8603130302.AA24244 Posted: Wed Mar 12 22:02:26 1986 Date-Received: Fri, 14-Mar-86 06:07:47 EST Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 37 >Geoff Wyant > DEFINITION MODULE FormattedWordIo ; > > EXPORT QUALIFIED Write2, Write6, Write10 ; > > PROCEDURE Write2(formatString: ARRAY OF CHAR; > w1, w2: WORD) ; > PROCEDURE Write6(formatString: ARRAY OF CHAR; > w1, w2, w3, w4, w5, w6: WORD) ; > PROCEDURE Write10(formatString: ARRAY OF CHAR; > w1, w2, w3, w4,..., w10: WORD) ; > END ; Although this isn't the greaqtest, it keeps Modula-2 as is.. one thing that could be done (enter kludge mode) is to have the modula equivalent of the C preprocessor, which changes FormattedWordIo.Write( "% is equal %", x, y); to FormattedWordIo.Write2( "% is equal %", x, y); and FormattedWordIo.Write( "%, %, and % are less than %", w, x, y, z); to FormattedWordIo.Write4( "%, %, and % are less than %", w, x, y, z); That way, you satisfy the need for general I/O, and the requirement for type checking. Obviously, the M2 pre-processor would check number of % 's against number of args, and report an error. The disadvantage is the extra pre-process step. What do people think?? Chris Shaw watmath!watrose!cdshaw or cdshaw@watmath University of Waterloo He said... Bogus as HELL !!!