Squeakers,
One stupid question regarding Compiler>>evaluate:in:to:notifying:ifFail:.
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?
Boris
Boris, See class SyntaxError for a relatively stand-alone thing that can be a notified object. Make bomb be a subclass of SyntaxError, and hand it in to be notified. Or, if you don't like that, examine the protocol of SyntaxError and StringHolder to see what your class has to respond to. Yes, its not very clean for what you want to do.
--Ted.
Ted Kaehler, Walt Disney Imagineering, R&D (home) 3415 Cork Oak Way, Palo Alto, CA 94303. voice (650) 424-1070 http://www.webPage.com/~kaehler2/ *** All cities in area code 415 south of San Francisco are now in 650. 415 no longer works for them. ***
squeak-dev@lists.squeakfoundation.org