Hello Brent,
the argument that follows the keyword evaluate: should not be a stream, but a string. Write
result _ Compiler new evaluate: exprStream contents in: nil to: nil notifying: nil ifFail: failBlock.
or simpler:
result _ Compiler new evaluate: ' 1 + 2 ' in: nil to: nil notifying: nil ifFail: failBlock.
to get the expected result.
Cheers, Boris Gärtner
msg systems ag Fraunhoferstraße 9 85737 Ismaning
Tel.: (+89) 96 101 546 mailto: Boris_Gaertner@msg.de
"Brent Vukmer" bvukmer@blackboard.com Gesendet von: squeak-dev-admin@lists.squeakfoundation.org 27.12.2001 16:26 Bitte antworten an squeak-dev
An: squeak-dev@lists.squeakfoundation.org Kopie: Thema: the magic behind "do it"
Selecting "2 halt" and inspecting brought me to the method Compiler#evalute:in:to:notifying:ifFail. I wrote a script to access this method directly ( see below ). I am getting nil instead of 3. When I debugged, it looks like the Parser is generating the following MethodNode: DoIt ^ nil
What do I need to do to get Compiler-love?
| exprStream result failBlock |
exprStream _ ReadWriteStream on: ''. exprStream nextPutAll: '1 + 2'. failBlock _ [ Transcript show: 'ArithmeticExpression#eval FAILED: ', exprStream contents. ]. result _ Compiler new evaluate: exprStream in: nil to: nil notifying: nil ifFail: failBlock. ^ result
squeak-dev@lists.squeakfoundation.org