Mutable state in Sebyla

Constantine Plotnikov

Any mutable state is a risk of creating communication channel. So any mutability of state is specified explicitly. By default all slots, fields and locals are immutable. This should not cause many problmes as most in objects and locals are really single assigment. They are initlized in constructor and never change later. Locals are also mostly syntax assigment.

One of special cases is iteration, but as iteration is automated with foreach statement, this could be automated too.

To declare field in the object, val [mutable] name:Type [= initialValue]; statement is used. (there could be other modifiers, but it is not important for this paper)

To declare variable in the code, val [mutable] name:Type [= initialValue]; statement is used. Note that value shold be initialized before use. It is enforced by compiler and verifier.

The slot is some sort of derived variable. Possibly syntax of it will be unified with field syntax. To declare slot[1] in the code, slot name:Type [= initialValue]{get;set;}; statement is used. As for slot setters and getter specified explicitly, there are not need of mutablity declaration.

It is possible to Ref[T] only to mutable state or field of muntable state.

It is also possible to declare lvalue function that will accept assigment. This design is similar to one that is used in Scheme.

[1] "Slot" term is taken from Dylan, C#/Java use "property" term for the same thing.