Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!psuvax1!rutgers!uwvax!daffy!khan.cs.wisc.edu!quale From: quale@khan.cs.wisc.edu (Douglas E. Quale) Newsgroups: comp.lang.misc Subject: Re: Run-time Type Errors in Smalltalk Message-ID: <1991May18.020425.462@daffy.cs.wisc.edu> Date: 18 May 91 02:04:25 GMT References: <1991May16.175340.25522@kodak.kodak.com> <1991May17.045347.26722@daffy.cs.wisc.edu> <1991May17.221539.22844@kodak.kodak.com> Sender: news@daffy.cs.wisc.edu (The News) Organization: University of Wisconsin -- Madison Lines: 44 In article <1991May17.221539.22844@kodak.kodak.com> cok@islsun.Kodak.COM (David Cok) writes: >In article <1991May17.045347.26722@daffy.cs.wisc.edu> quale@saavik.cs.wisc.edu (Douglas E. Quale) writes: >>>> In dynamically typed languages >>>>a lot of things that can be type errors in static languages simply *cannot* >>>>cause errors. >>>.... The same set of errors would occur. So I do not >>>understand why "a lot of things that can be type errors in static languages >>>simply *cannot* cause errors [in a dynamically typed language]". >>> >> >>This point is very simple, but perhaps not obvious. For an example I'll use >>the X Toolkit again. >> >> int width; >> XtVaGetValues(widget, XtNwidth, &width, NULL); > >Again your example does not fill the bill -- you pick one where the type >checking is turned off, i.e. a weakly typed system. If you want to argue >that no current statically typed language is flexible enough to do the >right things with variable length argument lists -- you do not have to >convince me. But don't say that you do not get type errors in dynamically >typed languages -- you do; what you don't get are uncaught type errors -- that's I guess I should have gone a little farther with my example. I have two widgets, widget1 and widget2. I want to set widget2's width to be the same as the width of widget1. { int width; XtVaGetValues(widget1, XtNwidth, &width, NULL); XtVaSetValues(widget2, XtNwidth, width, NULL); } This code is bugged because I used the wrong type for width. But I really, really, really don't care what type width is. In lisp, (let ((width (xtgetvalue widget1 xtnwidth))) (xtsetvalue widget2 xtnwidth width)) has no type errors, and can't have any. Not uncaught type errors, no type errors, period. -- Doug Quale quale@saavik.cs.wisc.edu