Hacker News new | past | comments | ask | show | jobs | submit login
Names do not transmit meaning (parsonsmatt.org)
51 points by dmit on Sept 2, 2019 | hide | past | favorite | 41 comments



I like the article but I disagree: Mappable is the correct name in this case and does transmit the meaning which is contained in the "grammatical" expansion. The confusion here is that there are prerequisites to knowing what Mappable means. One should know what map, the more primitive concept, means first. This is how derivational morphemes work. The productive suffixes still remaining in the English language such as "-able" do in fact have meanings, as do verbs such as "map", and they combine to form new meanings.

Furthermore, a bunch of things being named terribly doesn't support the thesis that names don't transmit meaning. It supports the thesis that a bunch of people failed to communicate and they should have put much more effort into naming things accurately.

> Names don’t make them any easier or harder to understand

If we renamed every variable in Firefox, for example, with numbers, people would find it more difficult to understand, so this is an absurd thing to say. The reason we use names is because they do convey meaning. That meaning (index into our conceptual map) is what differentiates them from the numerical value of the string of letters which make up their textual representations and makes them so much easier to remember and understand contextually!


I completely agree with your take on this. If you know what a "map" is in the CS context, "mappable" makes perfect sense. Names are absolutely critical to the synthesis of knowledge, as they provide a simple symbol by which to refer to complex concepts, which gives you greater power in wielding those concepts.

---

Whenever the topic of names comes up, I reread one of my favorite blog posts I've ever come across: "What's in a Name" by Olin Shivers [0]. Here's the thesis statement:

> [My thesis advisor, Allen] Newell [...] explained his understanding of names: “They provide distal access.” That is, a name is a local piece of data that stands for some other piece of data, which is presumably large and remote. You can now use that small, convenient, local datum instead of the large, remote thing for which it stands.

(If, like me prior to reading this, you're unfamiliar with the word "distal", it means "Remote from the point of attachment or origin." [1])

[0] https://blog.janestreet.com/whats-in-a-name/

[1] https://en.wiktionary.org/wiki/distal#Adjective


> Whenever the topic of names comes up, I reread one of my favorite blog posts I've ever come across: "What's in a Name" by Olin Shivers [0].

Thank you for this! It was a really engrossing read.

> When he said “distal access,” he assumed that you, too, have structures on one side of your head representing what you know about, say, Neil Armstrong, and a smaller structure on the other side of your brain encoding the name “Neil Armstrong,” and cognitive mechanisms allowing you to fetch the former given the latter.

I thought this was an interesting example that glossed over some (to me) really interesting things in cross-contextual (usually cultural?) miscommunication. This assumption that the other person you're talking to has the same concept in mind for a word is at the root of all communication we do.

A simple example would just be UK to US English -- something as simple as "fanny," which has differing meanings to both populations.

For a non-geographical contextual gap, we can look at slang like "salty." a "salty meal," "salty boy," and "salty dog" are all completely different things.

Some of the biggest difficulties I run into with communication aren't with people who speak no English at all (I live in Japan), but people who speak English in a dialect(?) that's close to what I expect, but slightly different and used differently (e.g. as high context instead of low context). Sometimes I can be speaking with someone from India who has perfectly grammatically correct, fluent English, and suddenly be thrown for a loop when I realize that a word had a completely different meaning for both of us without either of us realizing it.

It's just a really interesting concept I think about a lot since I do a lot of cross-cultural communication.


In Scala a Set is "mappable" because it has a `map` method that goes over its elements and transforms them using the provided function. But it is not a functor, because its `map` does not obey the functor laws. If you take a Set of integers and pass an `isEven` function to `map` you will get a Set with a different structure (as long as there were originally at least two odd or two even numbers of course).

`Mappable` provides short-term comfort due to familiarity, but to do so it sacrifices precision that is essential in the long term.


I am also really annoyed by how Set and Map's map methods work in Scala (and have argued about it here: https://contributors.scala-lang.org/t/set-map-deduping-and-p...), I actually don't think that for all the shortcomings of the Set map method, it actually violates any of the Functor laws:

1) For all sets s, s.map(identity) == s ==> true

2) For all sets s, functions f and g, s.map(x => f(g(x)) == s.map(g).map(f) ==> true

On the other hand, Map's map method is much more horrible, and does violate the 2nd functor law where f == g == _.swap :

Map(1 -> 2, 2 -> 2).map(_.swap).map(_.swap) ==> Map(2 -> 2)

Map(1 -> 2, 2 -> 2).map(_.swap.swap) ==> Map(1 -> 2, 2 -> 2)

Further, it behaves differently depending on if it is known to be a Map at compile-time, or if it is only known to be an Iterable[(K, V)], due to overloading:

Map(1 -> 2, 2 -> 2).map(_.swap) ==> Map(2 -> 2)

(Map(1 -> 2, 2 -> 2): Iterable[(Int, Int)]).map(_.swap) ==> List(2 -> 1, 2 -> 2)


Ah, you're correct of course, as is TJSomething. While Cats and Scalaz don't provide a Functor instance for Set (and neither does Haskell for Data.Set), it's not for the reason I mentioned.


The very concept of functors was created to describe sets that did exactly that. The functor laws only require that there is an operator that can wrap a value from one category into the functor's target category, that mapping with the identity function is the same as the identity function, and that the results of composition of mapping with two functions is the same as the results of mapping with the composition of the two functions. Set fulfills these laws perfectly. There is no law for maintaining cardinality, because the functor laws don't care if cardinality is a concept that even makes sense for the target category in question.


> it sacrifices precision that is essential in the long term.

Definitions are precise, not names. Names aren't what makes math work, it's the precise definitions, inference rules and theorems, regardless of the language in which they are written. 'printf' does not work the same in all programming language yet everyone knows what that name means.


Right, names without context don’t have any meaning, but once you’re in the world of everyday workmanlike programming, mappable is a perfectly clear concept, where as functors as they are usually explained do not.

If you were to take someone who is new to programming and talk about mappable datastructures they would look at you blankly, but any random JavaScript programmer should know what you mean instantly.


Interesting the name of the function you define in Haskell for a type to use the Functor typeclass is "fmap", so the core library designers must agree with you to some extent.

I can forgive Haskell for using the word "functor" because it came from academic roots, it isn't a language like Go designed specifically to make things easy for programmers to pick up.


The thing the article misses that I personally like about Haskell's drawing interface names from math is that it makes the edges sharper. There's more room for argument about whether something is "really Mappable" then whether something is "really a Functor", and more room to be uncertain about what guarantees I have in using the interface.


Something is Mappable in Haskell when it instantiates the class and satisfies the necessary and sufficient conditions it is obligated to by informal yet explicit contract of the class. That is to say that definitions are what guarantee validity, not connotational semantics.


This misses the social component, which I think is pretty important.

Why isn't Set a Functor? Because it doesn't obey the functor laws (because a == b doesn't imply f a == f b). Why are those the functor laws? Because that's all that Functor means.

Why isn't Set a Mappable? Because it doesn't obey the Mappable laws. Why are those the Mappable laws? Because they're the Functor laws? Why should that be the case? Maybe we should pick (or have picked) different laws for Mappable? Maybe we'll find better laws for Mappable, but we've given up that rarefied connotative linguistic real estate. There's extra room for drama and bike-shedding that isn't present when we're using already established names that precisely describe the interface even if they happen to be unfamiliar.


+1. A portmanteau, a verbified noun, a nounified verb, and so on -- these "abuses" of language can help carry meaning in a way that random names cannot. That said, "functor" perhaps did sound to its originators like what "mappable" does to you (and me) now.


Open question: if Functor should be called Mappable, what would you call Applicative? EvenMoreMappable?

Similarly, if Semigroup should be called Appendable, what would you call Monoid? And is there a consensus on Monad as well?


As it is now, Applicative is really an applicative functor. In general, if a term covers a subset then there is a property which distinguishes the subset from its ambient set and we can use that property to qualify the term as being such.

On the other hand, obviously Monad should be called Burrito.


Why does Mappable mean "something that you can apply functions to" and not "something that you can apply as if it were a function"?


> Names can’t transmit meaning, and so a name shouldn’t be judged on how well it transmits meaning. That doesn’t mean that names can’t be judged at all - there are good and bad aspects to names.

Names can't transmit the complete meaning of a concept, but they can still transmit a partial or ballpark representation of that concept. In the world of linguistics it's easy to see how many names come from the composition of Greek or Latin roots, prefixes and suffixes, or Chinese composition of radicals. I don't find it particularly compelling to try to make the case that names cannot transmit ANY meaning at all -- therefore let's choose some other arbitrary criteria for judging names.

If you think about the concept of affordances/signifiers from HCI and interaction design, people do draw upon their past experience when encountering new, unknown concepts, and in the PL space a good name can streamline the process for learning a new concept. It's just that Functor has affordances from category theory and, well, most people haven't taken enough advanced math to access those affordances before encountering Functor.

I think Matt would have been better off calling this article "New Concepts Deserve New Names", rather than try to say that all names transmit no meaning whatsoever. I think I would agree that it's not a huge price to develop new affordances for Functor, Applicative, Monad, Semigroup, and Monoid, in comparison to the potential pitfalls of choosing a name that points to a potentially vague or incorrect meaning. And I personally like the names because although they were poor pointers to meaning, they were good pointers to their mathematical roots, and that makes me curious to learn more category theory.


     Names can't transmit the complete meaning of a concept
Exactly. It seems the author is stuck in a sort of "precision trap", where in their ideal world, there would be no ambiguity in names and when I referred to a foobaz, I'd be pointed only at a foobaz as it relates to xyzzy, and not ... I'm running out of silly variables.

Names are the first point that you often encounter a subject. Arguably, it's more important that a name be more familiar at the expense of precision. As the developer becomes more familiar with the concept, they'll understand, for instance, that "Select" in C# is for converting one object to another, and "Where" is for limiting the results. Sure, at first glance, one might think "Select" is for filtering, but the release of LINQ coincided with language features centered around reducing the need to write SQL, so the name "Select" and "Where" were used rather than "Map" and "Filter" because they correlated directly to keywords in SQL.

I'd argue both that "Familiarity is the reason names are chosen" and that in the context of software development, choosing familiar names that easily transfer to a concept that is "good enough" has greater value than picking an obscure, but precise word.


I think one of the best counterexamples is The Jabberwocky by Lewis Carroll. If names (and more generally English words) conveyed no meaning on their own and were simply keys in a large fuzzy hash table, the poem would be completely opaque. However, despite the fact that almost every word in it is made-up (new, never a be foreseen keys), I'd argue that most English speakers, after reading the poem, would have a reasonably common understanding of what "slithy" meant or what a "borogrove" was.

If names fit well with what a person already knows, they can aid memory and even impart understanding. If names are poorly chosen they can instead confuse.


Even more impressively, the poem is also sometimes used (untranslated) in classes teaching English as a second language. So you don't need to be a native speaker to intuit the intended meaning.


>> I’m about to go on a bikepacking trip ...

When I read that, I had never seen the word "bikepacking" before, but I think I've got a decent idea what it means. Words matter. Technical terms exist in a context and are not just arbitrary identifiers. If we called monoids broccoli and other concepts had other random words, programming would be harder. Not everything can get a great name, but we should try.


Naming things is one of the hardest problems in programming. No matter how much experience I get, I still run into problems where I can't think of a decent name for something on a regular basis.


Some thoughts on the matter:

1) Are there domains where naming things is easier? Perhaps even trivial? As a layman in both, biology and astronomy come to mind. Where you just find a Latin word vaguely describing what you see, and if nothing comes up you just pick a name of a famous person from your field that doesn't already have something named after them.

2) If non-English languages are also considered, are there any where naming things is easier? Have to keep in mind that a "good" name maintains a balance between descriptiveness and brevity.

3) Can this be considered as an advantage of point-free style?

4) Is naming things in programming hard as in "building a spaceship" or as in "making the NBA"? That is, can you name all the things if you put in enough effort, or are some things simply unnameable?


> If non-English languages are also considered, are there any where naming things is easier? Have to keep in mind that a "good" name maintains a balance between descriptiveness and brevity.

As a native English speaker with a relatively very weak understanding of Chinese, I find Chinese names to be generally understandable and English names to be completely opaque.

This is most pronounced when dealing with technical topics:

For example, because I know essentially no Latin or Greek, a name like "Bilirubin" means absolutely nothing to me. Whereas the Chinese word, 膽紅素 (膽 - gall bladder, 紅 - red, 素 - essence), is actually something I can break down and have any idea at all what it is.

Japanese is also generally better than English in this regard in my experience, but unfortunately it often borrows words from other languages. In this case, ビリルビン (birirubin), so it can be even more opaque than English.

In the case of "functor", I also find the Chinese (函子) more obvious than the Japanese (関手) or English.


> In the case of "functor", I also find the Chinese (函子) more obvious than the Japanese (関手) or English.

If not too much to ask, can you please explain how those non-latin characters form the meaning for the word "functor"? In my native tongue (Turkish), we borrow the word "functor" without applying a translation to it, thus it becomes one of those things you simply memorize and move on.

Do these Chinese and Japanese words form a meaning similar to something like "function-izer" or "function+abler" or something else?


函子 should probably be analyzed as an abbreviation of "函数" (function) + "子" ("essence of" or "atomic unit of"). This meaning of "子" is the predominant one when used in technical contexts. See molecule "分子" (unit of separation) atom "原子" (the original/fundamental unit) electron "电子" (unit of electricity) or monad "单子" (essence/unit of oneness) where the second character is third tone not neutral. Many of these originate in Japanese and are re-borrowed back into Chinese, but that's a story for another time.

A sibling comment points out that 子 can mean child. This is the original, ancient meaning of the character. This usage is still productive in modern Chinese (usually to mean sons), but the previous examples are examples of how the meaning has undergone some transformations to form derived, related meanings. The original meaning can also be found in technical contexts. Examples of this are 子集 (child + set = subset) and again 分子 (fraction + child = numerator) with the counterpart 分母 (fraction + mother = denominator). This is not how I scan functor 函子 though.

In the Chinese programming community, you'll usually just see the English words "Functor" and "Monad" used. I wouldn't be surprised if some Chinese programmers familiar with "Functor" do not recognize "函子." I've only ever seen 函子 used in math articles and occasional FP tutorials (and even then, given how dominant English is, it is often glossed by "Functor").


I attempted to dig into the meaning of the Japanese word for functor, 関手.

https://ja.wikipedia.org/wiki/%E9%96%A2%E6%89%8B

関 - Checkpoint or barrier, for example at customs and borders; "bolt" for closing a door; to relate. (https://kanji.jitenon.jp/kanji/463.html)

手 - Hand, method, to do something "by oneself" as in by own's own hands. (https://kanji.jitenon.jp/kanji/033.html)

So roughly/possibly "a method of relating".

"Function" in Japanese is 関数. Same first character as functor, and the second one means "number". It's also written as 函数, which comes from the Chinese word for it.

In the Chinese word for functor, 函子, the second character means "child".


Naming is hard because communicating is hard: you have to build a mental model in the mind of the future programmer that’s useful enough to allow them to work on the project and get stuff done reasonably quickly and not accidentally break something due to a misunderstanding.

I see a lot of people struggle with naming because they’re trying to materialise the ‘right’ name, when all you really need is one that’s good enough, unlikely to be misinterpreted, easy to find/look up docs, etc.


Names clearly CAN transmit meaning once a context and a vocabulary are a given, to quote Leslie Nielsen, isn't that right mr-poopy-pants? Even five year olds know this, and for some reason math- educated-types (look, i did it again!) are especially against combining symbolic representation AND semantic content in the same symbolic medium, even though the lesson from programming is that even though it can be hard, when it's done well, it's infinitely superior for humans to actually use in practice.

In defense of Haskell however, author does have a point. Names for abstractions and anything you cannot touch and hold and easily categorise as a human in everyday life are really hard because current English is almost void of good words that capture or describe these concepts. Map and reduce, as two examples he rightly points out, are no more meaningful to most people than any other name we could give, and the only reason we think they are or might be is when we come from a context that has already learnt them. The same could be said for add, minus, subtraction, division, if they weren't essentially universally taught in universal education.

Who knows, maybe in the future, when abstract programming becomes widely taught, maybe words and concepts around abstract operations will enter the mainstream language.

Although, as a controversial counter-proposal to that (which I am merely putting forth, not necessarily advocating, i admit ignorance in this regard) if it turns out that various levels of abstract thought are not universally learnable by humanity, which is to say, are there thoughts and concepts some/most people can't think, then such words and vocabulary will always be an 'elitist' language...

/random thoughts


It's probably just a quesion of what you are used to.

OOP terminology feels more "Software Engineer"-y to me and FP terminology feels more "Math"-y.

So OOP feels more at home and FP feels more foreign.

On the other hand, in OCaml feels at home and Haskell/PureScript feels very theory-heavy.


Saul Kripke built an entire career on what exactly names are, as covered in Naming and Necessity (https://en.wikipedia.org/wiki/Naming_and_Necessity), building on earlier work by Frege (https://en.wikipedia.org/wiki/Sense_and_reference). OP touches on some concepts they cover - it's definitely worth reading these two if you are interested in the philosophy behind names!


One of the funny things about "Monad" is that philosophers will probably come to it with a fairly rich concept of what a monad is, since it has been used since ancient Greece.

https://en.wikipedia.org/wiki/Monad_(philosophy)


This is called Unit in the context which we are discussing.

A monad is a different concept in this context.


Names are one part of a two-part code. The name transmits meaning to people with enough knowledge of the other part.

Liken them to other analogies using other names can help build up the required knowledge


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?


Honestly, 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.


Good 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.


I really didn't have much of an opinion on the subject but after reading this, I'm finding that the author effectively demonstrated why Functor, Monoid, Monad and most of the terms used in FP are terrible and why it's so hard to get people to explore pure functional languages. This is the opposite of what the author intended, but I was unable to find anything other than evidence against the argument the author was trying to make.

The author's central point and most of the arguments they make, throughout, prove the opposite of what they're trying to argue.

     The purpose of a name is a pointer
The author then goes on to use this statement as though they had actually said "The only purpose" or "the primary purpose". Context, here, is really, really important. The purpose of a person's name is an attempt to be a unique pointer to a person.

From there we twist in to how ineffective the way we name things is at being a unique pointer. But how unique of a pointer does a name have to be? If that was the primary, only or main focus, our language would reflect that. I wouldn't tell the kids to "open the door" when I'm in the bedroom, I'd tell them to "turn the kwikset lever handle on the master bedroom door". Or I'd use the fancy name for the kind of door (it's got a french name of some kind) we have in our bedroom.

In the first case, I'd be providing unnecessary information. In the second, my use of a unique name to describe a unique door in our home would land in this articles "nirvana", but my kids would stand there confused since they would not be familiar with the term.

     Names can't transmit *meaning*
Of course they can! The author is more-or-less trying to make the argument that "names shouldn't convey meaning", but you don't get to control what your readers do with what you provide[0]. In fact, it's clear that the main goal that language authors place on naming things is specifically to convey meaning. The author's argument now becomes "Names regularly transmit meaning and often the meaning they transmit isn't as accurate as I'd like it to be".

In fact, that an unfamiliar name was used for something where a more common, familiar term was available made understanding what a Functor was much more difficult. Had it been called Mappable, I would have been most of the way there[1]. Upon researching what a "Functor" was, I didn't trust any of the first several, simple, short answers because I assumed "if that's all it is, they wouldn't have used such an obscure name".

So the very use of a name unfamiliar to me conveyed meaning that it must be a much more complicated topic, or they would have used a term that landed on the 80% mark.

[0] Newspeak, aside.

[1] I didn't actually struggle with Functor, but that was the author's chosen term to focus on. For me, I think it was Monoid and Monad. I had been using F# for two years before I actually looked up the exact definition of those two terms. Knowing what they meant was, evidently, not important but that they were named something unfamiliar to me didn't immediately make me explore what they meant.


Isn't a Functor just a morphism from one category to another?


In my humble opinion, Haskell uses big words and obscure category theory terminology for simple concepts in order to make Haskell programmers look smart. It's actually rather selfish because it reflects poorly on other FP languages, people start to think that all functional programming languages are about applicative functors and kleisli arrows.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: