You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classC[A]: {x: A}//│ Defined class Cc=C{x=1}//│ c: c & {C#A: 'A | 1 .. 'A, x: 1}d=cwith{x="hi";y=2}//│ d: c & {C#A: 'A | 1 .. 'A, y: 2, x: "hi"}d.x//│ res: "hi"
To do this, I guess we should create a new object, copy over all the fields of the previous object (there is a JS method to do that but I forget its name), and set the new fields in the new object, potentially overriding old ones. We may have to also explicitly set the prototype of the new object to the same thing as the old one, so we retain class instance-ness.
The text was updated successfully, but these errors were encountered:
For instance:
To do this, I guess we should create a new object, copy over all the fields of the previous object (there is a JS method to do that but I forget its name), and set the new fields in the new object, potentially overriding old ones. We may have to also explicitly set the prototype of the new object to the same thing as the old one, so we retain class instance-ness.
The text was updated successfully, but these errors were encountered: