Skip to content

Generics vs Concrete Types #6

@Bluefinger

Description

@Bluefinger

After consideration and pondering how to enable interoperability between crates for RNG usage, it becomes clear that there might be difficulty in achieving the necessary tools for querying resources/components in a robust manner.

Generic Types

The problem here is not needing to introduce more dependencies, doing things like trait queries. However, the ability to define a custom RNG algorithm might be important for particular use-cases where higher quality/secure entropy must be used, limited within app code or non-interoperable plugin code. In these cases, cross-plugin determinism is likely not going to be the priority, instead only being local determinism (for testing purposes).

Concrete Types

In most cases, devs are likely not going to care about the algorithms, just that either the RNG is fast or secure. Concrete types remove the need for trait queries and simplify the process for a plugin to determine whether a global resource or a component is available. It becomes much easier to write code to make use of a global source or fallback to a non-deterministic default.

Both types could live in the crate, but their use-cases will be separate. Documentation should provide the cases for each and what bevy plugin authors should rely on for interoperability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions