Login  Register

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

Posted by Marcus Denker-4 on May 05, 2015; 11:24am
URL: https://forum.world.st/How-can-I-specify-the-bindings-when-evaluating-an-expression-tp4794352p4824536.html


yes, we could move it up to Association… but we should keep VariableBinding as a subclass of
Literal so that people in the future e.g. can put a halt on a variable defined in the
workspace.

And yes, in general we need a nice API for the compiler to hand bindings to it… it is on my TODO
list.


This Slice adds an API to the compiler to set a dictionary with bindings to be taken into account.
They are compiled as pushLinteralVariable: (thus refer to the association of the dictionary)

Smalltalk compiler
        bindings: { #a -> 3 } asDictionary;
        evaluate: '1+a'.

Internally this for now (ab)-uses the #requestor: API... later we will change this to be inverted: the requestors
should privide binding and get notified using Announcements.