Antwort: the magic behind "do it"
Boris_Gaertner at msg.de
Boris_Gaertner at msg.de
Thu Dec 27 15:52:02 UTC 2001
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 at msg.de
"Brent Vukmer" <bvukmer at blackboard.com>
Gesendet von: squeak-dev-admin at lists.squeakfoundation.org
27.12.2001 16:26
Bitte antworten an squeak-dev
An: <squeak-dev at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20011227/e33a1b79/attachment.htm
More information about the Squeak-dev
mailing list
|