Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisiting nil semantics in Variant and TypedArray #576

Open
wants to merge 48 commits into
base: main
Choose a base branch
from

Conversation

elijah-semyonov
Copy link
Contributor

@elijah-semyonov elijah-semyonov commented Oct 13, 2024

This PR contains the following changes, all of them are related to nil-correctness.

  1. Godot Variant with gtype == .nil should never surface in the user API. It will be always represented as Swift nil of Variant?. This allows direct integration of Swift nullability checks into Variant processing. We shouldn't have places where we have Variant?.some with Godot nil inside. This is accompanied with a lot of small code changes everywhere in the code to support this logic.
  2. All places that previously used Variant will now be Variant?.
  3. Improved ObjectCollection: TypedArray of objects can now work with nils (just like it does in GDScript).
  4. Godot Nil builtin class is omitted from translation.
  5. Some instrumentation for macro testing to make their updates less painful (generating a new macro test body and pasting it into clipboard, Mac only for now).
  6. New API inside Arguments to streamline gracious failing when Godot calls are done into @Callable or @Exported. It shouldn't crash the game/editor anymore and print errors instead.
  7. Update of MacroCallable and MacroExported for newer infrastructure and gracious failing if Godot calls into Swift-exported code with wrong arguments instead of crashing.
  8. Lots and lots of tests to cover all the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant