Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!gatech!newsfeed.internetmci.com!in2.uu.net!news.biu.ac.il!discus.technion.ac.il!tx.technion.ac.il!zviki
From: zviki@tx.technion.ac.il (Cohen Zviki)
Subject: Re: Evaluating code at runtime (is it possible?)
Organization: Technion, Israel Institute of Technology
Date: Thu, 15 Feb 1996 10:10:36 GMT
Message-ID: <DMtAxp.JAD@discus.technion.ac.il>
X-Newsreader: TIN [version 1.2 PL2]
X-Nntp-Posting-Host: tx.technion.ac.il
References: <4fqudv$35n@zip.io.org>
Sender: news@discus.technion.ac.il (News system)
Lines: 30

	Hello !

Trevor Gimbel (slugboy@zip.io.org) wrote:
: Is it possible to evaluate and execute smalltalk code at runtime?
: I'm using VisualAge for Windows 3.0.

	It's easy. IBM Smalltalk has a variable called 'Compiler' which is used
for that purpose (among other things). You simply send and #evaluate: message
with the string that contains your code and the code is executed. The Compiler
has more features - you can look into the class methods of EsCompiler (which
is acutally the compiler.

	Note that the evaluate is quite powerful, for example, you can 
execute something like: Compiler evaluate: '123' and get the number 123 as 
a result. Consider the possibilities...

	Of course, Smalltalk is a very flexible language and since you have 
full control of the environment it is also possible to add methods at 
"run-time" and compile them from a given source (though this is a bit more
complex, especially considering the version control of VA 3.0 - ENVY).
------------------------------------------------------------------------------
Zviki Cohen

In-line Skater                      Computer Science student 
Macintosh Developer                 Technion - Israel Institute of Technology
Smalltalk Hacker
		  E-mail:  zviki@tx.technion.ac.il
		  Homepage: http://wstud.cs.technion.ac.il/~s2533197/

    	"It's easier to attract honey with flies"
