Message-ID: <170323Z23091994@anon.penet.fi>
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!news.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!EU.net!news.eunet.fi!anon.penet.fi
Newsgroups: comp.lang.smalltalk
From: an133124@anon.penet.fi
X-Anonymously-To: comp.lang.smalltalk
Organization: Anonymous contact service
Reply-To: an133124@anon.penet.fi
Date: Fri, 23 Sep 1994 17:01:46 UTC
Subject: Curious bug in most versions of Smalltalk
Lines: 75


Smalltalk folks,

Here is an interesting and probably rarely encountered bug that seems to
bedevil nearly every implementation of Smalltalk: super isn't handled
very gracefully when encountered in a method in Object.  The failure
modes are varied and interesting.

Install the following code **as an instance method in Object**, then
execute the comment.  But, before you try this at home, read the summary
of results on a number of platforms.

testSuperSend
    "^Object new testSuperSend"
    ^super species

Summary of results:  (Note: the grades and ranking are subjective...let's
not waste newsgroup bandwidth flaming or debating the fine points of which
failure mode is better or worse.)

IBM gets an 'A' for IBM-VisualAge 1.0 -- The compiler catches the error
and correctly notifies you with an error message at the appropriate place
in the code: 'super not allowed'

Digitalk V/Win32 gets a 'B' -- The compiler provides an error in the code 
saying: 'undeclared'  I'd give it an 'A' except it allows you to declare
super as a temp, then compiles OK and crashes when you run it...so one
gets the feeling that the undeclared message is a lucky accident.

Digitalk VOS2 gets a 'B-' -- The compiler generates a walkback with a
correct message: 'class has no superclass'.  Now if they had just
generated the same error message in the code rather than allowing the
compiler to walkback, it would have been an 'A'. 

Digitalk V/Win, and V/286 get a 'C' -- The compiler generates a walkback
'id not understood' which is completely uninformative.  Since the source
is hidden, it's up to the programmer to figure out the error.

ParcPlace gets a 'C-' for VW 2.0 Windows -- The compiler is happy and at
runtime it gets a walkback for anObject 'does not understand species'.
At least from the debugger it ought to be easy to spot the bug.  But it
does raise the interesting question of how the walkback comes about
since species is implemented in Object.

Digitalk V/Mac 1.2 gets a 'C-/D+' -- The compiler doesn't complain and
the method returns Object. Depending on how/why the erroneous reference
to super found its way into a method in Object, the lack of a crash could
be benign or malignant.

QKS Smalltalk Agents 1.4 also gets a 'C-/D+' -- It compiles and returns
Object.

QKS gets an 'D' for Smalltalk Agents 1.1, and it wins the govner's
'most bizarre result trophy' -- It compiles and at runtime returns Object
which would get it a C-/D+ except that '^super foo' returns 4, even
though there is no 'foo' method.

ParcPlace VW 1.0 for Windows, HP unix, Mac, and OS/2 all get 'F' -- they
compile and crash on the Mac and Windows, core dump in unix, and freeze
everything but the cursor and the three-finger-salute in OS/2.


So, folks, *carefully* try this on your favorite flavor of Smalltalk
and see if there are any other strange failure modes.


Cheers,
Steve Burbeck
KSC
sburbeck@ksccary.com
-------------------------------------------------------------------------
To find out more about the anon service, send mail to help@anon.penet.fi.
Due to the double-blind, any mail replies to this message will be anonymized,
and an anonymous id will be allocated automatically. You have been warned.
Please report any problems, inappropriate use etc. to admin@anon.penet.fi.
