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 tikal.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!hplabs!tektronix!uw-beaver!tikal!bobc From: bobc@tikal.UUCP (Bob Campbell) Newsgroups: net.lang.mod2 Subject: VARARGs (The real debate) Message-ID: <368@tikal.UUCP> Date: Tue, 11-Mar-86 02:04:20 EST Article-I.D.: tikal.368 Posted: Tue Mar 11 02:04:20 1986 Date-Received: Sat, 15-Mar-86 20:35:35 EST References: <735@well.UUCP> Reply-To: bobc@tikal.UUCP (Bob Campbell) Organization: Teltone Corp., Kirkland, WA Lines: 54 Keywords: MODULA-2, SIMPLE, KEEP IT. Summary: Why not a Macro Preprocessor. The is (and has been for some time) a debate about implementing varable arguments handling in modula-2. So to insure that my ideas are heard I summit the following suggestion: Why not use a Macro preprocessor to implement this feature. This type of system could handle most of the things required by the I/O systems: For example MACRO PrintF(control:STRING,VARS:LIST); VAR tmp: STRING; i,element: INTEGER; BEGIN element := 0; i := 0 WHILE i <= HIGH(control) DO IF (control[i] = '%') THEN IF (tmp <> "") THEN WriteString(tmp) END; IF (element > HIGH(list)) THEN ERROR('Missing Parameter'); RETURN; END; INC(i); CASE (control[i]) OF 'c': WriteChar(LIST[element]); .... END; ELSE APPEND(control[i],tmp); END; INC(i) END; IF (tmp <> "") THEN WriteString(tmp) END END PrintF; Now if this "Macro" is executed at compile time you have a printf which will detect type errors at compile time. This also can work like NEW, and DISPOSE as the programmer can select where Write... is imported from. One advantage of this Idea is that if you write this preprocessor then you can make money selling it to people like me who would like to add these types of features to a compiler that I already have. The syntax etc is not well worked out (not yet maybe someday) but this could create a portable extention to the language. Bob Campbell Teltone Corp. Kirkland Wa. {amc,dataio,fluke,uw-beaver}!tikal!bobc