The naming of this Clarity function has evolved from eq via eq? to is-eq, with the affixes intended to indicate that the function returns a boolean. However, in Clarity, the other predicates starting with is- are all tests for type variants:is-ok, is-err, is-some, and is-none, making is-eq an odd duck. Also, while these predicates take a single argument, the equality function is variadic, making is- grammatically incorrect. Other predicates like not and > don't start with is- so it is not a consistent pattern. The equality function should not be prefixed with is-.
While eq is historically used in Lisp languages to compare for object identity, it is an abbreviation that may not be generally obvious. For Clarity, we should favor terms that preferably can be understood without having to consult the language reference. Using equal would be a good choice. For precedence, equal is also used in other Lisp dialects including Common Lisp as a more general equality test.
A compact alternative is to use = . As precedence, it is already used for equality in the Clojure lisp dialect. There is currently no function with this name in Clarity, despite the availability of < and >, so its inclusion would make Clarity more complete.
The is-eq function tests for equality, but the name is cryptic. It could benefit from being renamed to a more understandable term such as
equal
.The naming of this Clarity function has evolved from
eq
viaeq?
tois-eq
, with the affixes intended to indicate that the function returns a boolean. However, in Clarity, the other predicates starting withis-
are all tests for type variants:is-ok
,is-err
,is-some
, andis-none
, makingis-eq
an odd duck. Also, while these predicates take a single argument, the equality function is variadic, making is- grammatically incorrect. Other predicates likenot
and>
don't start withis-
so it is not a consistent pattern. The equality function should not be prefixed withis-
.While
eq
is historically used in Lisp languages to compare for object identity, it is an abbreviation that may not be generally obvious. For Clarity, we should favor terms that preferably can be understood without having to consult the language reference. Usingequal
would be a good choice. For precedence,equal
is also used in other Lisp dialects including Common Lisp as a more general equality test.A compact alternative is to use
=
. As precedence, it is already used for equality in the Clojure lisp dialect. There is currently no function with this name in Clarity, despite the availability of<
and>
, so its inclusion would make Clarity more complete.Related: https://github.com/blockstack/stacks-blockchain/issues/1126 https://github.com/blockstack/stacks-blockchain/issues/998