Closed dchelimsky closed 4 years ago
I like this approach but indicates-match
feels like a strange name =/
I like this approach but
indicates-match
feels like a strange name =/
What do you suggest?
match?
receives actual
and expected
and indicates-match?
receives a match-result
, so
; currently
(indicates-match? (match? odd? 1)) ;=> true
;proposal
(matched? (match? odd? 1)) ;=> true
because match-result
is the result of an already executed match?
@fernando-nubank I like the fact that indicates-match?
reads very different from match?
. I think we should move away from having different fns with very similar names (match
, match?
etc)
I, personally, prefer indicates-match?
over matched?
for this reason:
matched?
makes you think of an event that happened in the past: did it match back then when it happened?
indicates-match?
says exactly what it means: does the thing you gave me indicate a match? It doesn't care how or when the thing got made.
@rafaelzlisboa I would like to have a single worded function, but you got a point. Let's keep it then
I would like to have a single worded function,
Keep in mind that this is really for internal use, or in support of building custom matcher functions in other libs. It's not something people will type very much, if ever, but when they see it, they're very unlikely to confuse it with match?
;)
There are currently 3 versions of
match?
:matcher-combinators.core/match?
matcher-combinators.standalone/match?
matcher-combinators.test/match?
(clojure.testassert-expr
- not really a function)core/match?
receives a match result (map) while the others receive expected/actual values.This PR eliminates the confusion by deprecating
core/match?
and replacing it with a newindicates-match?
function.This is not a breaking change, and will have almost no fan-out within Nubank.