File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,31 @@ a.field2 = {} # 2
1313b = a.field1
1414c = a["field1"]
1515
16+ # FrankenScipt uses reference counting. Values are deallocated when the reference
17+ # count hits 0. This can be used to remove unused elements from the diagram.
18+ a = None
19+ b = None
20+ c = None
21+
1622# FrankenScript also provides stings, created by double quotes:
1723d = "This is a string"
1824
25+ # All objects in FrankenScript are dictionaries. The language uses prototypes
26+ # to share functionality across objects and to identify the type of object.
27+ # The diagram currently shows the prototype for frame objects (called `[Frame]),
28+ # and the prototype for strings (called `[String]`).
29+ #
30+ # Prototypes can be accessed via the `__proto__` field.
31+ e = d.__proto__
32+
33+ # The prototype can also be written to. This creates an object `g` with the
34+ # prototype `f`
35+ f = {}
36+ f.field = {}
37+ g = {}
38+ g.__proto__ = f
39+
40+ # If a field is not found on an object the prototype will be checked for the
41+ # field. In this example, a reference to `f.field` is returned since `g` doesn't
42+ # have a field called `field` but the prototype has one.
43+ h = g.field
Original file line number Diff line number Diff line change @@ -271,6 +271,12 @@ namespace rt::objects
271271 [[nodiscard]] virtual DynObject* set (std::string name, DynObject* value)
272272 {
273273 assert_modifiable ();
274+
275+ if (name == PrototypeField)
276+ {
277+ return set_prototype (value);
278+ }
279+
274280 DynObject* old = fields[name];
275281 fields[name] = value;
276282 return old;
You can’t perform that action at this time.
0 commit comments