gdext icon indicating copy to clipboard operation
gdext copied to clipboard

GDScript utility API

Open Bromeon opened this issue 1 year ago • 4 comments

In addition to Rust APIs, users may benefit from simple building blocks in GDScript. On Discord, one idea that came up was mapping Result<T, String> to GDScript, that would allow accessing either the result or an error message.

This is in early brainstorming stage and may be something we don't end up doing, but discussion on the topic is appreciated 🙂

Some topics that need to be clarified in particular:

  • How to distribute it (GDScript has no dependency system)
    • let the user copy .gd files?
    • register some "system" Rust classes that are accessible in GDScript?
  • How and where to document them
  • How to version them
  • Alternatives (ideally the user doesn't have to use those to interoperate with gdext, but it may be a nice quality-of-life addition)

Bromeon avatar Jun 06 '23 09:06 Bromeon

* How to distribute it (GDScript has no dependency system)
  
  * let the user copy `.gd` files?
  * register some "system" Rust classes that are accessible in GDScript?

Having messed around with some potentially useful ergonomics stuff, i think having support for such "system" rust classes could be useful. though probably either as a separate crate or behind a feature flag.

things like converting closures into callables or implementing Future for signals would likely require something like this.

lilizoey avatar Jun 07 '23 03:06 lilizoey

Could this be distributed as a plugin on the asset library?

TitanNano avatar Jun 16 '23 07:06 TitanNano

if it's a "system" rust class (my preference), then the documentation should probably appear in godot itself at least.

@TitanNano if it's gd files, then it could be a plugin imo but if it's a "system" rust class, then it's just registered in the .so file

astrale-sharp avatar Jun 16 '23 10:06 astrale-sharp

Could this be distributed as a plugin on the asset library?

Possibly, however that might be quite hard to keep in sync with the gdext version -- and there's no dependency or package manager for assets/plugins in Godot.

As such, having gdext-provided "system classes" is likely the more promising approach.


if it's a "system" rust class (my preference), then the documentation should probably appear in godot itself at least.

That could be done if https://github.com/godot-rust/gdext/issues/178 is implemented.

Bromeon avatar Jun 16 '23 10:06 Bromeon