Christopher Howard <christopher.how...@qlfiles.net> writes: > Hi, is the a way I could use goops such that I the classes are non- > mutating, but have setters that simply return a new instance of the > class (instead of modifying the original)?
We provide such a mechanism for SRFI-9 Records. Search for "Functional Setters" in section 6.6.16 (SRFI-9 Records) of the Guile manual. > I suppose I could simply use define-method to create setter methods > which create a new instance of the object; but that would get rather > complicated, wouldn't it, if the object had superclasses? So I need > some kind of shallow copy mechanism for the whole object, or a chained > copy mechanism...? For GOOPS classes, take a look at the built-in 'shallow-clone' generic function. It is described in section 8.10 (GOOPS Object Miscellany). Mark