Mercerenies / gdlisp

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

Exported Vars #4

Closed Mercerenies closed 3 years ago

Mercerenies commented 3 years ago

Opening an issue for this, as it'll need to be done at some point. Godot supports export syntax for instance variables on top-level classes (and, as far as I know, only on top-level classes).

export var example = 1

And the export syntax has tons of little goodies that tell the editor things about your variable. I want to support as much of this as possible. There's minimal need for validation, and most of it is ad-hoc (like it is on the Godot side), so it's mainly just that I need to decide on an appropriate syntax for expressing this.

Mercerenies commented 3 years ago

bcb7582 closes this issue, with the syntax as follows

(defvar example 1 (export int 1 5))

export is not a function; it's a part of the defvar syntax. Both it and the initializer are optional, and either or both may be omitted. The "arguments" to export must be constant expressions (in the defconst sense) or literal symbols. The symbols are not, as of right now, checked against anything, which may be a future enhancement possibility.