Skip to content

lastindex and firstindex return type #27090

Open

Description

As noted at #26775, we currently allow custom lastindex and firstindex implementations to return non-Int values. For example, Date ranges use an Int64 index, and their last index (and length) cannot always be represented using an Int on 32-bit.

In PR #26775, this required defining lastindex and firstindex in terms of eachindex(IndexLinear(), x) rather than of LinearIndices(x). While it's not really an issue in practice, the fact that LinearIndices is not always able to represent the indices of ranges could be considered as a problem.

Is this really the desired behavior, or should we require that indices be Int?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]system:32-bitAffects only 32-bit systems

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions