labs-lang / labs

LAbS: a Language with Attribute-based Stigmergies - Parser + Code generator
BSD 3-Clause "New" or "Revised" License
7 stars 0 forks source link

Atomic tuple update #5

Closed lou1306 closed 6 years ago

lou1306 commented 6 years ago

Suppose <var1, var2> is a tuple inside some stigmergy.

Right now an agent can only update the variables one at a time:

var1 <~ expr1; var2 <~ expr2; ...

In some scenarios, however, it would be useful to allow for an atomic update of both values. Proposed syntax is

var1, var2 <~ expr1, expr2

which should avoid conflicts with the existing constructs

lou1306 commented 6 years ago

Let us generalize this:

Then the basic process r1, ... rn <- e1, ..., en (r. r1, ... rn <~ e1, ..., en, r1, ... rn <-- e1, ..., en ):

  1. evaluates e1, ..., en against the current state of the agent. Let v1, ..., vn the resulting values
  2. assigns each v_i to the corresponding r_i.

Notice that after the process is completed, the global clock will have been increased n times. Currently, this has no consequences, as tupled stigmergic variables still end up with equal timestamps. However, we should correct this if we want use the global clock for other things in the future.