←back to thread

178 points todsacerdoti | 2 comments | | HN request time: 0s | source
Show context
user-the-name ◴[] No.26340320[source]
"emplace_back"? People actually looked at this and went "Yes, this is a good function name. I understand this perfectly."?
replies(5): >>26340335 #>>26340345 #>>26340374 #>>26340547 #>>26343435 #
cannam ◴[] No.26340547[source]
I quite like the name, not least because it accurately gives the impression of "something you will probably misunderstand".
replies(1): >>26341205 #
1. sillysaurusx ◴[] No.26341205[source]
This had me burst out laughing. Thanks for that perspective. I guess that's one way to solve the naming problem: just make all your names super obscure as a warning to any would-be students of the dark arts.
replies(1): >>26341638 #
2. kevincox ◴[] No.26341638[source]
My personal rules of naming, in order of importance are:

1. Be unique.

2. Don't be misleading.

3. Be leading.

So in this case you are nailing 2 but missing out on three which I would consider a "pretty good" name. Sure, it would be nice if it was a bit more obvious (maybe construct_in_place_back?) but at least it doesn't sound like it does something else so people know to look it up.