We should continue the discussion here and include the implementation you have so far. I believe implementation wise, the two main questions were:
1. Should it only compare structs of the same kind 2. Or should it compare across types. If comparing across types, how would the protocol dispatch work. Should we sort both elements and dispatch the first as first? Note that Date.compare, Time.compare, and friends changed on Elixir master and are now able to compare across types. It does a field-based comparison instead of a struct-based comparison. For example, Date.compare/2 can compare any type that contains the fields year, month and day. When it comes to adding it to Elixir, the main drawback was that we didn't agree it added enough to the language to warrant its inclusion in Elixir. In particular, if the feature feels detached from Elixir overall, i.e. it is just a new function+protocol that doesn't actually integrate with Elixir features, such as guards, then it is probably best to leave it as a library. Especially because it may affect future decisions in the language. For example, imagine we can access map fields or write case expressions in guards. Would that allow us to write a guard-able compare expression? How that would affect the compare implementation? Those are the same reasons why we decided to not include Decimal as part of the standard library, it's why we don't provide an Array/Vector/Queue, etc. If it is limited in scope it is probably best to leave it apart so we still have the option to provide something truly integrated later on. *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4JT53QSSMhSffJ3oy66rEx6CViH4mmJ%2BCO%3D5ToGdKoN2w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
