1.6 class assign

Class assign defines an assignment statement for a var object. An assign is an executable object that, when executed, evaluates its assign<-value and assigns its assign<-var with this value. See class var for a discussion on variables and assignments (var->assign).

Class assign is first of all introduced for syntactical cosmetical reasons. The following two code objects perform the same function:

assign(Var, Value).
message(Var, assign, Value).

An assign object demands its first argument to be an instance of class var. This implies that named variables can be referred to much more elegant. Executing

assign(x, 10)

Will assign 10 to the variable named x, while the message variant would be:

message(?(@variables, member, x), assign, 10)

See also code<-convert.

See also
class var

1.6.1 Instance variables

assign <-> scope: {local,outer,global}
Scope of the assignment. See var->assign for the interpretation of the scope names. The default is local.
assign <-> value: any|function
Value to assign to the variable. In many cases this will be a function object, which is executed by the assign object when it is assign->_execute’d.
assign <-> var: var
Var object to assign. See also assign<-value and var->assign.

1.6.2 Send methods

assign ->_execute:
The execution of an assign object implies

  1. Evaluate assign<-value if this is a function object.
  2. var->assign the assign<-var with the result of 1).
assign ->initialise: variable=var, value=any|function, scope=[{local,outer,global}]
Create a var object from the assign<-var, assign<-value and assign<-scope.