What is the reason for variant classes being returned by value rather than by reference? #54
Unanswered
Benjamin-Dobell
asked this question in
Q&A
Replies: 1 comment
-
I think the gdscript magic happen in the gdscript compiler, it compiles the statement // I don't know too much details about the internals of gdscript compiler,
// but the assignment is actually run as this statement:
/*gdscript_vm.cpp line 1216*/ bool ok = ClassDB::set_property(p_instance->owner, *index, *src, &valid); // src is Vector2(x, y) here So, it's impossible to implement in the same way in most third-party language integrations. And for the second question, no special reason of using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been digging into GodotJS' internals. I'm new to Godot and v8, so a lot to learn 😓 I'm curious as to the motivation of choosing by value over by reference for the variant classes. C# bindings operate similarly, so it's by no means a show-stopper. However, it would be nice to have similar capabilities to GDScript and do stuff like
node.position.x = 5
. I'm assuming there's performance concerns?Somewhat related, what's the reason for going with
SetAccessorProperty
overSetNativeDataProperty
?Beta Was this translation helpful? Give feedback.
All reactions