Skip to content

Strong typing for IDs #128

Closed
@hyanwong

Description

@hyanwong

@MomoLangenstein suggested that it might be a good idea to enforce strong typing on integer IDs in the Rust API, so that you don't, for example accidentally pass an individual ID to a function that expects a node ID. There was some discussion in the Slack channel about this: apparently some similar type constraints were previously implemented in the tskit C API but then removed because it required typing too much boilerplate, for not much discernible benefit. But @molpopgen has just said:

Interestingly (because you can't do this in C), you seem to be able to do this in rust in a way that may not break API and would still allow the plain tsk_id_t to be passed to functions.

Perhaps @MomoLangenstein could weigh in here with what they were thinking about?

ID types needed for this to be closed:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions