Skip to content

Use T.new(value) to typecast to generic index types, not T.zero + value #21

@shinzlet

Description

@shinzlet

This is mostly a pattern that's used in IndexRegion and (i think) the iterator classes - often we need to get the value 1 in some generic integer type T, so we've been using T.zero + 1 to typecast. But you can also just do T.new(1), which is cleaner, more obvious, and safer overall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions