-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
equalityIssues relating to equality relations: ==, ===, isequalIssues relating to equality relations: ==, ===, isequalfeatureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestshashing
Description
Dear Julia community,
what started as a short discourse discussion I would like to rephrase as a change request.
Currently, Base.Some
is treated like Ref
in that Some([]) != Some([])
, unlike Vector for instance. However in other programming languages, Some
actually behaves more like Vector in the sense that it is paired with Nothing and in this combination represents a Container of either one or zero elements.
For instance in Scala Some(List()) == Some(List())
.
For consistency with the general semantics of Some/Option/Optional/Maybe (or however it might be called in other programming languages), I would plead for adding the following two lines to Base
Base.:(==)(a::Some, b::Some) = a.value == b.value
Base.hash(a::Some) = hash(a.value)
This is a breaking change.
yurivish and andyferris
Metadata
Metadata
Assignees
Labels
equalityIssues relating to equality relations: ==, ===, isequalIssues relating to equality relations: ==, ===, isequalfeatureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestshashing