Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!ncar!oddjob!uxc!uxc.cso.uiuc.edu!a.cs.uiuc.edu!p.cs.uiuc.edu!gillies
From: gillies@p.cs.uiuc.edu
Newsgroups: comp.lang.modula2
Subject: Re: C v.s. Modula II
Message-ID: <79500014@p.cs.uiuc.edu>
Date: 18 Aug 88 02:38:00 GMT
References: <79500004@p.cs.uiuc.edu>
Lines: 45
Nf-ID: #R:p.cs.uiuc.edu:79500004:p.cs.uiuc.edu:79500014:000:2265
Nf-From: p.cs.uiuc.edu!gillies    Aug 17 21:38:00 1988


In article <79500010@p.cs.uiuc.edu> gillies@p.cs.uiuc.edu writes:
>>I call the Dictionary.Enumerate[] procedure, and it repeatedly makes
>>call to the ShowName procedure. FURTHERMORE, from within the ShowName
>>procedure, I can access & change the variables global to
>>PrintDictionary (wh, the window handle).  This is crucial if you want
>>to get something done, in a type-safe manner.  I don't think C++'s
			      ^^^^^^^^^
>>pointer parameters cut the mustard.....

Written  2:32 am  Aug 16, 1988 by chris@mimsy.UUCP in comp.lang.modula2
>Yes they do, but I will write this in C, rather than in C++.  (C++ can
>make short work of it by using classes, so that is no fun at all.  It
>is interesting, though, to note that either Dictionary or Window must
>be a subclass of the other to do it.  That problem vanishes with
>multiple inheritance, coming soon to a C++ compiler near you :-) .)

(C programming example omitted)

Your example isn't type-safe, although it's same solution I use.  I
only asked the question because I knew it couldn't be answered in C.
Your coding trick starts crumbling with nested callback loops
(something you've probably never considered because it's so tedious in
C!)

Maybe it can be done type-safely in C++.  I hope it doesn't take one
class per callback proc or one per nest!  I am leery of C++, since it
resembles MESA, in that it's a cooking pot with everything but the
kitchen sink thrown in!  The result is an even bigger language that's
hard(er) to master (than C).

I think MESA descended from Algol and BCPL.  It happens to be enough
of a superset of PASCAL that a PASCAL->MESA translator exists.  If a
Xerox interviewer said that MESA was closer to 'C', he was massaging
your fears and/or stretching the truth.  The joke at Xerox is that
Modula-2 "is all the MESA Nicklaus Wirth could remember when he
returned to Switzerland" (he was a visiting scientist at Xerox).

Mesa lacks the pointer arithmetic of C, but has all the arithmetic
operators like :?, and also & !  >> << through the InLine procedure
library, with no loss in performance.


Don Gillies, Dept. of Computer Science, University of Illinois
1304 W. Springfield, Urbana, Ill 61801      
ARPA: gillies@cs.uiuc.edu   UUCP: {uunet,ihnp4,harvard}!uiucdcs!gillies