Mercerenies / gdlisp

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

Imported constants don't count as constant #108

Closed Mercerenies closed 2 years ago

Mercerenies commented 2 years ago
;; a.lisp
(defconst Foo 1)

;; b.lisp
(use "res://a.lisp" open)
(defconst Bar Foo)

Bar will err out, saying its value is not constant enough. This is because GDLisp compiles Foo to _Import_0.Foo, and then (very late in the process) it tries to validate that _Import_0.Foo is constant. This is too late, since we've already lost any static information about what _Import_0 is.