Skip to content

Naming inconsistencies #773

Open
Open
@Bromeon

Description

@Bromeon

This issue collects godot-rust symbols, whose current names could be made more expressive in a future version. This includes anything: types, functions, macros, variables. It excludes generated names from the GDNative bindings, as they are not chosen by us*.

All of these are up to discussion, of course. Migration could happen step-wise: v0.10 deprecates the names and adds type aliases for the new names (or for old ones), and v0.11 removes old names.

  • RefInstance -> TInstance
    Analogous to Ref and TRef, the latter is the temporary, lifetime-bound variant of the former.
    RefInstance suggests that this is a mix between Ref and Instance.

  • TypedArray -> PoolArray
    Would immediately reflect that it's the Rust counterpart of GDScript's Pool*Arrays.
    We need to decide if it makes sense to keep Int32Array and Float32Array around.

  • VariantArray -> Array (?)
    This one is a bit less clear: while it would match GDScript's type Array, the name "Array" is very general and doesn't clearly describe the purpose. On the other hand, the same problem occurs with Dictionary. However, "dictionary" is quite specific to GDScript terminology; in Rust such types are typically called "maps".

  • Conversions between Ref, TRef, Instance, Script etc.
    Some terms are used interchangeably (base/owner), while some are not related to the conversion involved (claim). This is OK to some extent, but we need to be careful that there are not too many names that need to be "learnt by heart", as that makes APIs less accessible.

  • Type states; e.g. Access -> Ownership
    See this comment.

Related, but planned for v0.10: #712


* Note regarding GDNative types

A lot of them have multiple capital letters, e.g. ARVRCamera, AudioStreamOGGVorbis, PCKPacker, UPNP, WebRTCPeerConnection and more. Would likely cause more confusion than benefit to "correct" them, add lots of manual special cases, and sometimes become obsolete in Godot 4. What needs to be checked though is why this was done for some types like G6dofJointAxisParam. Godot seems to use G6DOFJointAxisParam, and GDNative apparently too. But where does the de-capitalization in godot-rust originate?

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeIssues and PRs that are breaking to fix/merge.c: coreComponent: core (mod core_types, object, log, init, ...)quality-of-lifeNo new functionality, but improves ergonomics/internals

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions