🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3972

Re: Run-time Type Errors in Smalltalk

#3972
From: Douglas E. Quale
Date: Wed, 15 May 1991 14:18
33 lines
2576 bytes
In article <1991May13.082152.29294@tkou02.enet.dec.com> diamond@jit533.enet@tkou02.enet.dec.com (Norman Diamond) writes:
>In article <1991May13.061520.11992@daffy.cs.wisc.edu> quale@khan.cs.wisc.edu (Douglas E. Quale) writes:
>
>>A specific example is provided by the X Toolkit Intrisics.
>>To get information from a widget you use a call that looks like this:
>>  XtVaGetValues(widget, XtNwidth, &width, XtNheight, &height, NULL);
>>Unfortunately width and height are type XtArgVal which is a union which
>>completely defeats any typechecking.  The correct type is Dimension, should
>>I instead use int I get no help from the compiler, and my code has a type
>>error.  This kind of type error CANNOT occur in a dynamically typed
>>language.
>
>It could occur in a dynamically typed language, if the programmer can tell
>the language to throw away tagging and type-checking.  A competent programmer
>would put a tag in the union type.  (C is not an encouraging language for
>this kind of practice, but it still could be done.)
>

In lisp, the most ``common'' dynamically typed language, you cannot throw away
tagging.  You are, however, somewhat at the mercy of the compiler in regards
to type checking unless you explicitly make the checks yourself.

But the fact is, this particular error does NOT occur in a dynamically typed
language.  If you or anyone else reading this is familiar with the X
Toolkit Intrinsics and can see a way to avoid this problem I'd like to hear
about it.  The designers of the Intrinsics found that C's static typing
wasn't adequate for their needs and built an unchecked dynamic type system
on top of it.  Now C's type system is very primitive, but I'm not certain
that any static type system is flexible enough to handle this problem.  The
most promising approach might be a statically typed object oriented language.

-- Doug Quale
quale@saavik.cs.wisc.edu
Technical Details
Message-ID: <1991May15.141839.20603@daffy.cs.wisc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!spool.mu.edu!uwm.edu!uwvax!daffy!saavik.cs.wisc.edu!quale
References: <1991May9.023313.28308@tkou02.enet.dec.com> <1991May13.061520.11992@daffy.cs.wisc.edu> <1991May13.082152.29294@tkou02.enet.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!spool.mu.edu!uwm.edu!uwvax!daffy!saavik.cs.wisc.edu!quale
From: quale@saavik.cs.wisc.edu (Douglas E. Quale)
Newsgroups: comp.lang.misc
Subject: Re: Run-time Type Errors in Smalltalk
Message-ID: <1991May15.141839.20603@daffy.cs.wisc.edu>
Date: 15 May 91 14:18:39 GMT
Article-I.D.: daffy.1991May15.141839.20603
References: <1991May9.023313.28308@tkou02.enet.dec.com> <1991May13.061520.11992@daffy.cs.wisc.edu> <1991May13.082152.29294@tkou02.enet.dec.com>
Sender: news@daffy.cs.wisc.edu (The News)
Organization: University of Wisconsin -- Madison
Lines: 33