IvoryScript further reading

Byte code segments gain independence

IvoryScript byte code is organised into a hierarchy of segments. A closure refers to the segment containing its code and the values associated with its free variables.

When a closure is copied to another environment, such as a transient, persistent or remote store, its surrounding segment hierarchy need not accompany it.

Only its direct code segment is copied and detached from its parent. Captured free variable values are then copied in the normal way. Where one of those values is itself a closure, the same applies.

Segments are also shared where possible. If several copied values require the same segment, only a single copy of it is retained in the destination environment.

Copying a reducible value therefore copies only the byte code and captured values required for its reduction, not necessarily the program structure from which it arose.