dfinity / motoko-base

The Motoko base library
Apache License 2.0
483 stars 99 forks source link

Deprecate `TrieSet.mem()` in favor of `TrieSet.contains()` #576

Closed rvanasa closed 11 months ago

rvanasa commented 1 year ago

This PR deprecates TrieSet.mem() in favor of TrieSet.has() for consistency with the base library design document.

We could update the design guide if this makes more sense, although I think has would be less ambiguous than mem, which could be misunderstood as having something to do with "memory" instead of "membership" for developers familiar with wording such as "has" / "contains" / "includes".

kentosugama commented 1 year ago

So the Buffer class's membership function is called contains, and I did a quick search and it seems like there is actually no membership function in the base library named has, despite it being in the design doc.

Maybe it makes sense to call this functions contains and update the design doc to match that?

I do agree that mem is the worst option of the bunch.

rvanasa commented 1 year ago

I would be okay with contains (that was actually my first suggestion while talking with @matthewhammer about this before knowing about the design doc).