4 ms·
Functor is a good enough name. Much better than for example quark from particle physics with its colors. Mappable is definitely better in one specific context
by eveningcoffee 7y ago
Functor is a good enough name. Much better than for example quark from particle physics with its colors.
Mappable is definitely better in one specific context but contrary to the author I think that Iterable may be even better as it is a more generic name (Iterable can be also Foldable).
Or does Mappable mean that you will mutate the state?
But why not refer to multiple names? Functor also known as Mappable or Iterable?
- mdip 7y agoHonestly, I think Mappable and Iterable are both fine. Are they perfect? Maybe to one or two developers who's past experience precisely matched up. They're "good enough" because the reason we tend to name things the way that we do is because (1) we're trying to help the developer create/learn/form a mental model of the concept we're introducing and (2) we're providing experienced developers with a name that, when context is provided, allows for quick recall of the details of what was learned. A word that is very unusual (Monoid and Monad come to mind in that -- for me -- there wasn't a part of that word that conveyed meaning), might as well be a "magic number". I have to remember the concept, and this odd word that I'm only ever going to see in the context of this concept. That's OK when it's infrequent or when the concept is so far off from anything else that it necessitates a new word (Internet)[0]. Had they chosen the word "Mappable" over "Functor", it would be unimportant that in "language X" a Mappable is a Functor and in "language Y" it's something similar, but not exactly the same. Hell, even distant similarities (like Visitor pattern or Map) are useful. To remember what "map", in JavaScript did, I thought "C# 'Select'", since I had used that more frequently, but I also remembered that "thing X maps to thing Y", or "A map gets me provides a way for me to get from location A to location B". I can explain most of that with the word "map" and they have a quick way to remember it. I don't have an easy way to do that with functor. I don't even have a terribly good way to do that with the word "function". When I tell my kids to "Open the door" when they knock, I'm referring to the door they knocked on, not the front door, the garage door, or the sliding back patio door. They're all wildly different concepts for "door" but I can refer to each of them as a "door" with either implied (as-in the nearest door to where I'm standing) or by providing additional explicit context (the "back" door is enough for everyone who has visited my home, thus far, to understand that I'm referring to the sliding-glass patio door). [0] Note that I'm not referring to business names or names for people. They serve different purposes.
- eveningcoffee 7y agoGood points. > I don't even have a terribly good way to do that with the word "function" This is something I have internalized: function is a map is a map is a map from one set to another. This is the reason I think that Functor is not such a bad name.