@@ 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 [])))