Mercerenies / gdlisp

Lisp on the Godot platform
GNU General Public License v3.0
140 stars 1 forks source link

Cyclic references in outer class refs #85

Open Mercerenies opened 2 years ago

Mercerenies commented 2 years ago

An outer Reference class and an inner Reference singleton object will instantly be in a cycle and never get freed (and Godot issues a warning at exit time if this happens). Should we detect this? Should it be allowed? Can we hack it with weakref somehow?

Example:

(defn outer () 100)
(defobject Foo (Reference)
  (defn foo () (outer)))
(print (Foo:foo))
Mercerenies commented 2 years ago

See also object_test.rs, as there are some relevant (commented out) tests in there.