Mercerenies / gdlisp

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

GDScript Compatibility in Optional Arguments #77

Open Mercerenies opened 2 years ago

Mercerenies commented 2 years ago

Currently, we compile optional arguments to ordinary GDScript arguments, so

(defn foo (&opt y))

compiles to

func foo(y_0):
    return null

where we fill in the null default argument at every call site automatically.

We could compile to

func foo(y_0 = null):
    return null

to maximize compatibility with GDScript call signatures.

Consider how this interacts with functions that have both an optional and a rest (or array) argument.

Mercerenies commented 2 years ago

Upon further consideration, I've decided to defer this to v2.0.