Given the examples below, maybe it would be better to provide protocols for
each of those cases. The protocol would convert those data types to an
intermediate representation that would be easy to compare on.

On Monday, August 29, 2016, Wiebe-Marten Wijnja <[email protected]>
wrote:

> The idea is to be able to create application-specific comparisons between
> data types, *where these comparisons make sense*. Some examples:
>
>
> - Being able to compare Integers with Floats, Arbitrary precision Decimals
> (which are implemented as %Decimal{} structs by the 'decimal' package) and
> Rational numbers (which are implemented as %Ratio{} structs by the 'ratio'
> package).
> - Being able to compare different Vector or Matrix types in a similar way.
> - Being able to compare datetimes in different storage formats or
> calendars with each other.
> - If your application works with %Bike{}, %Car{} and %Truck{} structs, it
> might make sense to always have the ordering %Bike{} < %Car{} < %Truck{},
> and have some other kind of criteria when comparing one %Bike{} with the
> other (like frame height) or one %Car{} with the other (like motor
> capacity).
> - Being able to compare elements in any other imaginable partially
> ordered set <https://en.wikipedia.org/wiki/Partially_ordered_set>, where
> elements of the poset might be of different types.
>
> Comparing e.g. a Decimal with a Timex date makes no sense in most
> contexts. (If you want, you could go ahead and do something like letting a
> Timex date be larger iff it is an odd date. It is nonsensical, but
> possible). Therefore, an implementation of the multiprotocol that would be
> used to compare data types of these kinds would not be made.
>
> Does that answer your question?
>
>
> On Monday, August 29, 2016 at 10:06:07 PM UTC+2, OvermindDL1 wrote:
>>
>> To compare any type of number to any type of number?  Or to compare any
>> type of number to another of the same type?  Also I can see many usages of
>> compare beyond number comparisons too.
>>
>> If the first, I'm unsure what sense it is to compare, say, a decimal to a
>> Timex date?
>>
>>
>> On Monday, August 29, 2016 at 1:57:58 PM UTC-6, Ben Wilson wrote:
>>>
>>> Because half the point of the comparable protocol is making it easy to
>>> compare numbers generically, where "numbers" can be any of integer, float,
>>> decimal, rational.
>>>
>>> --
> 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]
> <javascript:_e(%7B%7D,'cvml','elixir-lang-core%[email protected]');>
> .
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/elixir-lang-core/b31aec7d-6bb0-4afa-ae88-
> 9adfa6aa4537%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/b31aec7d-6bb0-4afa-ae88-9adfa6aa4537%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 


*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/CAGnRm4LBJe%2B6UdiZtWXrZ_PjK_rEuuoc9xPN15Gq%2BM-uRU8GuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to