Mercerenies / gdlisp

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

Extending Resources by Name #67

Closed Mercerenies closed 1 year ago

Mercerenies commented 2 years ago

In GDScript, it's possible to have an extends clause that extends a filename directly or an inner class of that file, such as

class A extends "res://AParent.gd": ...

class AInner extends "res://A.gd".AParentInner: ...

We need to support this syntax, as it's necessary for main classes which attach to scenes.

Consider how this interacts with the macro loading system (which will need to treat these as pseudo-imports and resolve them as though they were preloads)

Mercerenies commented 1 year ago

Closed by 9135412.

GDLisp does not support extending classes by string path. In GDLisp, a class always extends a known identifier. However, if a main class happens to extend an identifier in GDLisp and that identifier is the main class of another file or is an inner class defined in another file, then the current main class will compile to the string import syntax. There is no way to compile to this syntax on an inner class.

Basically, just keep doing what you would have done before this issue was closed, and GDLisp will do the intelligent thing for you.