~subsetpark/fugue

1a4cc8d88618497c21e2f00ec33c314445530024 — Zach Smith 1 year, 10 months ago 4814bcf allow-raw-table-proto
Update init form to work when a proto is based on a raw table
1 files changed, 4 insertions(+), 2 deletions(-)

M fugue.janet
M fugue.janet => fugue.janet +4 -2
@@ 174,7 174,7 @@
       # Recursively lookup defaults in prototype hierarchy
       (var current-proto self)
       (while current-proto
         (let [defaults (,get-in current-proto [:_meta :instance-defaults])]
         (when-let [defaults (,get-in current-proto [:_meta :instance-defaults])]
           (loop [[default-key default-value] :pairs defaults]
             (,put inst default-key default-value)))
         # Recurse to grandparent


@@ 190,7 190,9 @@
       # Associate instance with Prototype
       (,table/setproto inst self)
       # Call initialize method
       (:_init inst))))
       (if-let [init (inst :_init)]
         (init inst)
         inst))))

(put Root :new (eval (init-form 'Root [])))