Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!uwvax!picard.cs.wisc.edu!quale From: quale@picard.cs.wisc.edu (Douglas E. Quale) Newsgroups: comp.lang.misc Subject: Re: Run-time Type Errors in Smalltalk Message-ID: <1991May16.153308.4054@spool.cs.wisc.edu> Date: 16 May 91 15:33:08 GMT References: <1991May13.082152.29294@tkou02.enet.dec.com> <1991May15.141839.20603@daffy.cs.wisc.edu> <1991May16.011804.21042@tkou02.enet.dec.com> Sender: news@spool.cs.wisc.edu (The News) Organization: U of Wisconsin CS Dept Lines: 37 In article <1991May16.011804.21042@tkou02.enet.dec.com> diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) writes: > >typedef enum XtArgTag { > XtArgCaddr, > XtArgCharPtr, > XtArgLong, > XtArgIntPtr, > XtArgProcPtr, >} XtArgTag; >typedef union XtArgUnion { > caddr_t Caddr; > char *CharPtr; > long Long; > int *IntPtr; > proc *ProcPtr; >} XtArgUnion; >typedef struct XtArgVal { > XtArgTag Tag; > XtArgUnion Val; >} XtArgVal; > I think there are reasons why the X Toolkit Intrinsics doesn't do this. One of the design goals was binary compatibility with past versions. Notice that when you are forced to simulate dynamic typing in a statically typed language you can't do it as well as a dynamically typed language can. The explicit tags are bulky and slow compared to the representation tricks used by lisp compilers. Also the syntax is abominable, as you mentioned. To boot, when (or in my case more likely if) I write my own widget and introduce a new arg type I have to use Caddr, and type safety is shot to hell. Dynamically typed languages are safer than primitive statically typed languages such as C. -- Doug Quale quale@picard.cs.wisc.edu