Skip to content

Disambiguate the meaning of one #16116

Closed
Closed
@TotalVerb

Description

@TotalVerb

It seems that this is incorrect:

julia> one(Dates.Second)
1 second

The documentation of one says "Get the multiplicative identity element for the type of x". So the correct return would be Int64(1), since then one(Dates.Second) * Dates.Second(5) == Dates.Second(5) as expected. The current behaviour results in a MethodError which is not desirable.

If I did not miss something obvious, I could make a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    datesDates, times, and the Dates stdlib moduleneeds decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions