You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed a potential discrepancy in how the type of value is enforced in Registry.register/3 and Registry.match/4, not sure if it's by design as I could be misunderstanding the intended use cases.
According to their typespecs, the value argument in Registry.register/3 is of type term, and the pattern argument (which pattern matches the value) in Registry.match/4 is of type atom() | tuple().
Initially in my code, I used Registry to register a value that is a map. And when using Registry.match/4, I successfully matched the records also using a map as the pattern.
Only when I ran dialyzer did I notice that using map as the pattern is invalid.
So my question is: should a map be allowed as a type of pattern in Registry.match/4? If not, what would be the reason?
I find that for now I'd have to put the map inside a tuple, to satisfy the Dialyzer check.
The text was updated successfully, but these errors were encountered:
Hi,
I've noticed a potential discrepancy in how the type of
value
is enforced inRegistry.register/3
andRegistry.match/4
, not sure if it's by design as I could be misunderstanding the intended use cases.According to their typespecs, the
value
argument inRegistry.register/3
is of typeterm
, and thepattern
argument (which pattern matches the value) inRegistry.match/4
is of typeatom() | tuple()
.Initially in my code, I used Registry to register a value that is a map. And when using
Registry.match/4
, I successfully matched the records also using a map as the pattern.Only when I ran dialyzer did I notice that using map as the pattern is invalid.
So my question is: should a map be allowed as a type of pattern in
Registry.match/4
? If not, what would be the reason?I find that for now I'd have to put the map inside a tuple, to satisfy the Dialyzer check.
The text was updated successfully, but these errors were encountered: