Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.sprintlink.net!howland.reston.ans.net!torn!nott!cunews!dbuck
From: dbuck@superior.carleton.ca (Dave Buck)
Subject: Re: is smalltalk interpreted or compiled?
X-Nntp-Posting-Host: superior.carleton.ca
Message-ID: <DFyFyC.2D5@cunews.carleton.ca>
Sender: news@cunews.carleton.ca (News Administrator)
Organization: Carleton University, Ottawa, Canada
References: <44ugj8$gbe@academ00.mty.itesm.mx>
Date: Thu, 5 Oct 1995 02:51:48 GMT
Lines: 38

In article <44ugj8$gbe@academ00.mty.itesm.mx>,
OLIVIA ARACELY MONCAYO BELMARES <al582947@academ10.mty.itesm.mx> wrote:
> would like to know if smalltalk is interpreted or compiled....
>i've heard that some versions are interpreted...but i don't know exactly 
>which ones are and which are not....please if you know, send me mail to:
>
>al582947@academ01.mty.itesm.mx

This question is surprisingly difficult to answer because of the
definition of "compiled" versus "interpreted".  For VisualWorks and
Visual Smalltalk, it works like this:

The code you type in is fed to the Smalltalk compiler when you accept
a method.  The compiler compiled it and creates a compiled method (an
instance of CompiledMethod) which contains bytecodes - a simple
machine-like language which can be interpreted. In the old days of
Smalltalk, these bytecodes were interpreted directly.  Nowadays, a
technique called "dynamic compilation" is used.  The first time a
method is called, the bytecodes are translated into native machine
instructions.  The resulting native code is then cached.  Subsequent
calls to the same method use the cached code if it's available.  Since
there's typically not enough memory to keep all methods cached, there
is a scheme for discarding old cached native code in favor of the new
methods which are being run.

Is it compiled?  Yes.  It's compiled from source to bytecodes.  The
difference between Smalltalk and languages like C, C++, FORTRAN, etc.
is that the translation to native code occurs dynamically at run-time.

David Buck
dbuck@ccs.carleton.ca

_________________________________
| David K. Buck                 |
| dbuck@ccs.carleton.ca         |
| The Object People             |
|_______________________________|
 
