Login  Register

Re: How can I specify the bindings when evaluating an expression?

Posted by Sean P. DeNigris on Feb 04, 2015; 10:07pm
URL: https://forum.world.st/How-can-I-specify-the-bindings-when-evaluating-an-expression-tp4794352p4803777.html

Nicolai Hess wrote
Dictionary newFrom:{ WorkspaceVariable key:#a value:3.
WorkspaceVariable key:#b value:4}
Thanks! That works great :)

n.b. in Pharo 3.0, just replace the WorkspaceVariables with regular associations:
  Smalltalk compiler evaluate:'a+b'
    notifying: (Dictionary newFrom: { #a -> 3. #b -> 4 })
    logged: nil
Cheers,
Sean