#[func]
should not pass types not representable in GDScript
#327
Labels
#[func]
should not pass types not representable in GDScript
#327
Since #326, we use the same mechanism to pass types from/to the
engine
API (Rust -> Godot) as well as from to thebind
API (GDScript -> Rust, via#[func]
). This is generally a good thing, but for some types it's problematic.For example,
u64
is not representable in GDScript, so we should discourage accepting and returningu64
in#[func]
. GDScript always usesi64
asint
, so there is going to be an implicit conversion which can lead to a different value.However, such a
#[func]
API may have uses in the rare cases where another language (C++, C# or even Rust?) calls our Rust API.There are multiple options:
GodotFuncMarshal
, one for bind and one for engine APIUnstableU64(u64)
or so#[func]
API would require explicit packing/unpackingimpl Into<UnstableU64>
parameters -- but what about return types?The text was updated successfully, but these errors were encountered: