cqframework / cql-execution

A JavaScript framework for executing CQL
Apache License 2.0
63 stars 31 forks source link

Improve consistency of equality between objects #279

Open cmoesel opened 1 year ago

cmoesel commented 1 year ago

In the current implementation, equality of data types (e.g., Quantity, Date, DateTime, etc) can be determined in multiple ways:

  1. a.equals(b)
  2. b.equals(a)
  3. equals(a, b) (and perhaps also equals(b, a))

When PR #278 is merged, it will introduce another way:

  1. Immutable.is(a, b)

The results of these operations may differ depending on which one you call and which data types are passed in. This should not be the case, as all equality operations should be consistent and commutative. Ideally, they should all be backed by the same implementation.

For additional discussion, see: https://github.com/cqframework/cql-execution/pull/278#discussion_r988040642.