IIIM-IS / AERA

Other
12 stars 4 forks source link

StructureValue: recursive copy of sub-structures #257

Closed jefft0 closed 1 year ago

jefft0 commented 1 year ago

Background: A binding map stores values in subclasses of BoundValue. The StructureValue is used to store the bound value of a structured object such as (vec3 1 2 3). The copy_structure method of StructureValue copies the code of a structure into and out of an AERA object such as (mk.val h postition (vec3 1 2 3)) .

We want to support a bound value of a "nested" structure object such as (vec [1 2 3]), where the (vec :) is the top structure and the array [1 2 3] is the sub structure. This pull request updates copy_structure to check if part of the structure is an I_PTR which points to a sub structure. If so, then it calls itself recursively to copy the sub structure (and any further sub-structures). There is no change of behavior for existing AERA examples where no bound structured objects have sub-structures.