Supply named temporaries to Compiler>>#evaluate:...
I want to be able to evaluate a string like '2 + arg1' and supply anObject for arg1 to the compiler. I naively tried: | aContext | aContext := thisContext copy tempNamed: 'arg1' put: 1; yourself. Compiler evaluate: '2 + arg1' in: aContext to: nil which didn't even come close to working! Any pointers? ----- Cheers, Sean -- View this message in context: http://forum.world.st/Supply-named-temporaries-to-Compiler-evaluate-tp480368... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
2015-02-04 18:48 GMT+01:00 Sean P. DeNigris <sean@clipperadams.com>:
I want to be able to evaluate a string like '2 + arg1' and supply anObject for arg1 to the compiler.
I naively tried: | aContext | aContext := thisContext copy tempNamed: 'arg1' put: 1; yourself. Compiler evaluate: '2 + arg1' in: aContext to: nil
which didn't even come close to working!
Any pointers?
a workaround: http://forum.world.st/How-can-I-specify-the-bindings-when-evaluating-an-expr...
----- Cheers, Sean -- View this message in context: http://forum.world.st/Supply-named-temporaries-to-Compiler-evaluate-tp480368... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
On 04 Feb 2015, at 21:46, Nicolai Hess <nicolaihess@web.de> wrote:
2015-02-04 18:48 GMT+01:00 Sean P. DeNigris <sean@clipperadams.com <mailto:sean@clipperadams.com>>: I want to be able to evaluate a string like '2 + arg1' and supply anObject for arg1 to the compiler.
I naively tried: | aContext | aContext := thisContext copy tempNamed: 'arg1' put: 1; yourself. Compiler evaluate: '2 + arg1' in: aContext to: nil
which didn't even come close to working!
Any pointers?
a workaround: http://forum.world.st/How-can-I-specify-the-bindings-when-evaluating-an-expr... <http://forum.world.st/How-can-I-specify-the-bindings-when-evaluating-an-expr...>
Yes, we should provide a nice API⦠it is on my TODO but I did not manage to work on it yet. Marcus
participants (3)
-
Marcus Denker -
Nicolai Hess -
Sean P. DeNigris