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

Add support for initializer_list to TypedArray #1716

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomfull123
Copy link

This PR adds support for initializer_list syntax, allowing TypedArrays to be assigned more easily, with syntax such as: TypedArray<int> x = { 1, 2, 3 };

Its a nice to have feature that I've found missing while developing gdextensions, I'm also writing a gdscript to gdextension transpiler and this syntax would help to make that possible.

@tomfull123 tomfull123 requested a review from a team as a code owner February 22, 2025 00:04
@Ivorforce
Copy link
Contributor

Ivorforce commented Feb 22, 2025

Hi, and welcome!
This is a welcome contribution - initializer list construction is useful indeed.
In this case, it's relevant to know that godot-cpp has a design goal to stay close to Godot code as closely as possible. In some circumstances, this means not (yet?) adding features that are not in Godot upstream.

initializer_list construction for TypedArray is a bit of an outlier though, perhaps. While it's not in Godot yet, there are three (!) open pull requests that attempt to add it ([1], [2], [3]). It's probably only a matter of time till the Godot codebase merges one that adds them... But arguably we might wait to merge this PR until then.

@tomfull123
Copy link
Author

Yeah I saw those PRs a while back, I wasn't sure if it was a requirement to have it in Godot first, either way, I don't mind waiting, at least this PR will be ready to go when we finally get the feature in the Godot codebase.

@dsnopek dsnopek added enhancement This is an enhancement on the current functionality waiting for Godot This issue needs a Godot Engine improvement to be solved labels Feb 22, 2025
@dsnopek dsnopek added this to the 4.x milestone Feb 22, 2025
@dsnopek
Copy link
Collaborator

dsnopek commented Feb 22, 2025

Thanks!

However, I think we should wait for Godot to merge one of the upstream PRs before merging this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement on the current functionality waiting for Godot This issue needs a Godot Engine improvement to be solved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants