//: So far you can have global variables by not setting default-space, and //: local variables by setting default-space. You can isolate variables //: between those extremes by creating 'surrounding' spaces. //: //: (Surrounding spaces are like lexical scopes in other languages.) :(scenario surrounding_space) # location 1 in space 1 refers to the space surrounding the default space, here 20. recipe main [ 10:number <- copy 5:literal # pretend array 20:number <- copy 5:literal # pretend array default-space:address:array:location <- copy 10:literal 0:address:array:location/names:dummy <- copy 20:literal # later layers will explain the /names: property 1:number <- copy 32:literal 1:number/space:1 <- copy 33:literal ] # chain space +mem: storing 20 in location 11 # store to default-space +mem: storing 32 in location 12 # store to chained space +mem: storing 33 in location 22 //: If you think of a space as a collection of variables with a common //: lifetime, surrounding allows managing shorter lifetimes inside a longer //: one. :(replace{} "long long int space_base(const reagent& x)") long long int space_base(const reagent& x) { return space_base(x, space_index(x), Current_routine->calls.