Values of types nil, boolean, int, real, char, string, fun, meth, set, list, and tag are immutable. This means that once a particular value is calculated or declared in a constant, the value cannot change. For example, appending a character to a string creates a new string; inserting an element into a set creates a new set, and so on.
In contrast, objects and special objects are mutable by the fact that their field values can be modified, and new fields can be added.
Two immutable values are equal if their contents:
have the same boolean value (true or false).
have the same numerical value (by converting ints to reals if necessary).
have the same character or string.
have the same function or method with identical dynamic outer context.
Two objects are regarded equal when the internal reference to the object data stucture is equal (i.e. reference equality).
It is important to note that even though sets and lists are immutable in WebL, operating on these value types does not necessarily mean that the internal data structures are copied for each operation. WebL uses an efficient internal implementation that makes the following operations possible in constant time and space:
Applying the First and Rest functions on a list,
Adding or removing an element from a set.
In some cases, for example when printing a list or indexing into it, a cost proportional to the number of elements is paid once, after which the cost becomes constant again.