Dynamic Objects

version 8/140515 by Jesse McGrew

  • Home page
  • Beginning
  • Next

  • Documentation

    Chapter: Basic cloning
    This extension allows new objects to be created by cloning existing objects. Once we've defined a suitable prototype object, we can refer to "a new object cloned from" it, like so:
        let the copy be a new object cloned from the prototype;
    That line will create the new object and assign it to the variable called "copy". The copy will be the same kind as the prototype, and have all the same property values.
    By default, the new object will not be participating in any of the relationships of the prototype object. To clone the relationships as well, use the "preserving relations" option:
        let the copy be a new object cloned from the prototype, preserving relations;
    Note that even with this option, one-to-various (or various-to-one) relationships are only preserved when the cloned object is on the "various" side, and one-to-one relationships are never preserved.
    If memory runs out and the new object cannot be created, the phrase will return "nothing".