[Main website]


TODO there is a paper saying that some references can be identified using some “root-like” reference and then a zip path to the final reference. The same can be true in Dok where with AG I signal some reference and then I can use the AG also as a zip path.

References vs Values

A reference has an identifier that can be managed internally from the run-time system, and properties that are its value part. Its value part can change.

A value can be seen as a reference where all its property are part of the identifier. Hence, if some part of the value change, it becomes a new value.

References during AG visit

A reference in Dok can be generated during visit of AG. It is similar to a zipper: the reference is the starting base of the zipper path, and then there can be a path.

References in AG


TODO References to container elements

$x = $array[5]

TODO if the container change, and I change later $x what is the semantic? Probably it points to the 5 element. TODO every container has its semantic for references.

Values as implicit references

Some values can be used as references. For example if a value is retrieved from a DBMS table, some slots can be primary keys, hence they are the reference of the value respect the DBMS as root. id is used instead of slot for identifying a slot that is used for referencing the value on some external data store.

class C [
  id some-id::Int -default 0
  slot name::String

var c1::C(with id 1, with name "Massimo")
var c2::C(with id 2, with name "Massimo")

In these cases, c1.value is a copy of c with the id in their default value.

assert c1.id == 1
assert c1.value.id == 0
assert c1.value == c2.value
assert c1 =/= c2