🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.st80
Article #300

Re: Typed Smalltalk

#300
From: graham
Date: Fri, 18 Jul 1986 21:35
53 lines
3290 bytes
I have implemented and used a simple type checking system for Smalltalk.
This has convinced me that a type  checking  Smalltalk  compiler  for  the
standard  Smalltalk system is both possible and very useful. My motivation
has been the desire to  improve  the language, the programming environment
and a firm belief in strong type checking.


I currently have a type checking system based along the ideas presented in
the paper by Borning &  Ignalls  about type checking Smalltalk. Basically,
type declarations are added to messages and variables and then used by the
compiler. Type declarations specify what sort of object is expected, using
the idea of 'classes as types'. Each  class has a corresponding type, with
the types existing in a type-subtype hierarchy. 

This system actually has a number of serious  shortcomings  but has served
its purpose in finding out  what  they  are  and  investigating  potential
solutions. The next incarnation should be genuinely useful. 

What are the main benefits of strong type checking?
-   Elimination  of  DoesNotUnderstand  errors at runtime. No more messing
about with the debugger trying to track down type errors.

-  Early detection of errors.  The programmer can be told of and deal with
errors at compile time. The compiler  should  detect  as  many  errors  as
possible, rather than simply turn out code regardless.

-   Documentation.  I  must  have spent hours searching through the system
trying to find what sorts  of  objects  may be passed as parameters with a
message, or what a variable is used for.  The Smalltalk system is very big
and it needs this extra layer of specification. 

- Separation of the specification of what is done from how it is done. A
class defines a set of messages (just names) and method bodies. Very often
the method body is the only specification  of  what  a  message  does.  If
you're  lucky  it  will contain some useful comments, usually you're stuck
with trying to understand  code.  A type system can be used to specify the
protocol of an object without having to delve into implementation details. 

- System managment. A type system  can  be  used  to  check  that  all the
components of the system fit together and that new components fit with the
existing ones. This is very  important, think of the amount of information
within the Smalltalk environment. There must  be  reliable tools to manage
it.


To conclude, I believe that a strong type checking system for Smalltalk is
possible, for the system as it stands now. It can be interactive,
unobtrusive, useful and a genuine enhancement to the system.

Graham Roberts
Queen Mary College,
University of London
graham@uk.ac.qmc.cs
Technical Details
Message-ID: <172@cs.qmc.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utcs!mnetor!seismo!mcvax!ukc!icdoc!qmc-cs!graham
References: <546@watmum.UUCP> <803@cit-vax.Caltech.Edu>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utcs!mnetor!seismo!mcvax!ukc!icdoc!qmc-cs!graham
From: graham@qmc-cs.UUCP
Newsgroups: net.lang.st80
Subject: Re: Typed Smalltalk
Message-ID: <172@cs.qmc.ac.uk>
Date: Fri, 18-Jul-86 17:35:34 EDT
Article-I.D.: cs.172
Posted: Fri Jul 18 17:35:34 1986
Date-Received: Mon, 21-Jul-86 05:59:46 EDT
References: <546@watmum.UUCP> <803@cit-vax.Caltech.Edu>
Reply-To: graham@cs.qmc.ac.uk (Graham Roberts)
Organization: CS Dept, Queen Mary College, University of London, UK.
Lines: 53