godotengine / godotengine/godot-docs
PackedByteArray passing by reference
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
The documentation v: stable (4.0) says:
> Built-in types are stack-allocated. They are passed as values. This means a copy is created on each assignment or when passing them as arguments to functions. The only exceptions are Arrays and Dictionaries, which are passed by reference so they are shared. (Packed arrays such as PackedByteArray are still passed as values.)
But `PackedByteArray` doesn't seems to be passing by value, it's behavior shows that it is being passed by reference:

This will print: `[1, 2, 3, 4, 5, 6]`, the same behavior as Array, it's not being copied, it's being referenced. So I think documentation is wrong.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.