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.160453.4486@spool.cs.wisc.edu> Date: 16 May 91 16:04:53 GMT References: <1991May13.082152.29294@tkou02.enet.dec.com> <1991May15.141839.20603@daffy.cs.wisc.edu> Sender: news@spool.cs.wisc.edu (The News) Organization: U of Wisconsin CS Dept Lines: 26 In article olson@juliet.ll.mit.edu ( Steve Olson) writes: >In article <1991May15.141839.20603@daffy.cs.wisc.edu> quale@saavik.cs.wisc.edu (Douglas E. Quale) writes: > In lisp, the most ``common'' dynamically typed language, you cannot throw away > tagging. > >Careful, there is no single thing called "lisp". (Its more like a state >of mind :-) This is exactly what an optimizing Common Lisp compiler will do. >Spectacular errors (worthy of C :-) will result if you lie when you make >your type declarations. > Yes, this can happen but in general Common Lisp doesn't get rid of the tags (because it can't). Suppose foo takes a single integer argument. If foo is visible to the world the CL compiler can't find every invocation at compile time and so the call (foo 0) will require 0 to be tagged. It is possible to give foo two entry points, one for regular boxed data calls and another for unboxed data, but in general the tag will be there. Usually optimization tells the compiler not to look at the tags. This can cause spectacular failures. You can shoot yourself in the foot in practically any language, but a language like C encourages unportable, unsafe practices. In Common Lisp it's more work to write unsafe code than safe code. -- Doug Quale quale@picard.cs.wisc.edu