Question: #evaluate:in:to:notifying:ifFail:

Boris G. Chr. Shingarov usib6tfj at
Fri Mar 27 16:41:51 UTC 1998


One stupid question regarding

I want to evaluate a string and take some special action in case
of compilation error.  For example, imagine I want to bombically
destroy the user's computer if he enters a syntactically wrong
Smalltalk expression and tries to DoIt.  For that case, I implement
class Bomb with Bomb>>explode, and

Bomb>>notify: string at: index in: stream

	self explode

Then I say:

| stream |
stream _ ReadWriteStream on: string from: 1 to: string size.
Compiler new
     evaluate: stream
     in: nil
     to: nil
     notifying: bombInTheCorner
     ifFail: [].

Although the comments in Compiler don't say anything about this,
in fact the bomb receives many other messages which it does not
understand as if it were a ParagraphEditor (even if the expression
is perfectly ok) =:^$.  Any simple solution?


More information about the Squeak-dev mailing list