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
overMap
, what happens when the type also fits other common algebraic structures like Contravariant? Do we keepContramap
and accept the mismatch withSelect
? Do we make up names likeContraSelect
? - If we choose
Map
overSelect
, 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
?