-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Review Mojo's priorities
- I have read the roadmap and priorities and I believe this request falls within the priorities.
What is your request?
For the proposed List.index
method to be operational, it is essential to first implement the CollectionElement
trait to conform to the EqualityComparable
trait. This prerequisite ensures that the types used within the List struct are comparable (equal/not equal), thereby allowing the index
method to accurately find index of the given value by comparing it to all those present values in the list.
Moreover, in the future, the possibility of defining 'default method implementations within a trait' can simplify custom structs’ ability to be used in a list by removing the explicit necessity for implementing both __eq__
and __ne__
methods in those structs. This is aimed at achieving a level of simplicity and ability in lists similar to what we can currently find in Python.
What is your motivation for this change?
This is an essential step forward for having more stable and Pythonic collection datatypes available in Mojo while narrowing down the differences between these two languages.
Any other details?
No response