0

I'm designing a type in C# that will be used as an algebraic type in a functional style, but is not a collection type and does not implement IEnumerable. If this type is a Functor, should I name its projection method Select or Map? Similarly, if it's Filterable, should I name that method Filter or Where? What are the pros and cons of following LINQ's naming convention vs. matching the larger functional community?

For concrete examples, consider things like Optional<T> and IObservable<T>.

Considerations:

  • If we choose Select over Map, what happens when the type also fits other common algebraic structures like Contravariant? Do we keep Contramap and accept the mismatch with Select? Do we make up names like ContraSelect?
  • If we choose Map over Select, how "collection-like" can our type get before we're more or less in direct conflict with LINQ?
  • Following LINQ names allows for query syntax support, but do we want to encourage or discourage query syntax for types that are very unlike IQueryable?
5
  • The gist of your question can be grokked by simply reading the title. Ultimately, this is a matter of opinion. Aug 28, 2018 at 21:43
  • I suppose if someone wants to downvote a question immediately, without comment, based on "the gist", there's nothing I can do to stop them, but that person is certainly a detriment to this site. Aug 28, 2018 at 21:45
  • Oh, I don't know. Voting on Stack Exchange is anonymous by design, and after reading your question, the title covered my understanding with about 95 percent accuracy. I've actually thought about your question before, and concluded that there's no right or wrong answer. Like many language features, it's a matter of personal taste (for better or worse). Aug 28, 2018 at 21:51
  • Does that make it a bad question? If there was an obvious right or wrong answer, why would I bother asking? Is this not the right site for posing interesting software engineering questions? Aug 28, 2018 at 21:55
  • Yes, but we prefer answering questions factually. Aug 28, 2018 at 21:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.