# Naming: Remove all underscores to matter what?

**URL:** <https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549>\
**Category:** General Usage\
**Created:** [January 23, 2018, 5:52pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549 "2018-01-23T17:52:55Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [January 25, 2018, 7:08pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/101 "2018-01-25T19:08:45Z")

</div>

> [@gabrielgellner](#):
>
> I just don’t buy that this is the same as real progress in notation

You’re right, it’s not. But those of us who dislike the underscore feel that it is analogous, and the underscores annoy us to a significantly lesser, but still non-negligible, degree.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 25, 2018, 8:43pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/102 "2018-01-25T20:43:48Z")

</div>

> [@ExpandingMan](#):
>
> But those of us who dislike the underscore feel that it is analogous, and the underscores annoy us to a significantly lesser, but still non-negligible, degree.

Then again, there are many of us who find the _lack_ of underscores in base to separate words annoying, to a non-negligible degree. 😄

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 25, 2018, 8:48pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/103 "2018-01-25T20:48:43Z")

</div>

Actually, the [Julia contributing guide](https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md) says the following:

> try to adhere to a 92 character line length limit  
> use upper camel case convention for modules, type names  
> use lower case with underscores for method names  
> it is generally preferred to use ASCII operators and identifiers over Unicode equivalents whenever possible

That does seem very clear - why aren’t the core team following their own guide? 😉

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 26, 2018, 2:35am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/104 "2018-01-26T02:35:15Z")

</div>

Is `inverse_hyperbolic_sine(x)`really preferable to `asinh(x)`?

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 2:46am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/105 "2018-01-26T02:46:42Z")

</div>

That’s a straw man argument - I don’t think anybody has suggested that at all.  
We’ve been talking about function names that are composed of more than one English word, not common mathematical abbreviations.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 26, 2018, 3:09am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/106 "2018-01-26T03:09:47Z")

</div>

The stdlib functions that become sufficiently commonly used acquire a similar status to standard math library functions, I think. Then I would propose my argument applies.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 3:18am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/107 "2018-01-26T03:18:26Z")

</div>

Can you give some examples? If you are talking about things like the C/C++/Posix functions such as `isgraph`, `isalpha` etc, I’d make a cleaner API for base Julia (I had a PR over 2 years ago to do just that), and put the `isalpha` etc. abbreviations into a `Posix` module, just like I’d put MATLAB abbreviations into a `Matlab` module.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 26, 2018, 3:20am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/108 "2018-01-26T03:20:21Z")

</div>

`readdir`, for instance.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 3:24am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/109 "2018-01-26T03:24:09Z")

</div>

I would make that `read_directory`, for sure.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 26, 2018, 3:26am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/110 "2018-01-26T03:26:34Z")

</div>

`chown` then becomes `change_owner_and_or_group`?

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 3:29am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/111 "2018-01-26T03:29:47Z")

</div>

I’d leave it in a `Posix` module as `chown`, and attempt to come up with some more generic function with keywords for a Julia API for operating on file metadata.

---

<div class="post-metadata">

**Author:** ![bramtayl](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bramtayl/32/3614_2.png) [@bramtayl](https://discourse.julialang.org/u/bramtayl)\
**Post date:** [January 26, 2018, 3:38am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/112 "2018-01-26T03:38:11Z")

</div>

I would be totally fine with

`sine(x, inverse = true, hyperbolic = true)`

and if I had my wuthers we’d have

`file_metadata(owner = 2, group = 2)`

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [January 26, 2018, 4:43am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/113 "2018-01-26T04:43:06Z")

</div>

Where are you copy / pasting from? Don’t decent editors have an easy way to view the docs inline?

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 10:47am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/114 "2018-01-26T10:47:10Z")

</div>

I think Emacs is a more than decent editor, but I am unaware of a way of pulling up the Julia help for an operator or method in Emacs, even with `julia-mode.el`. Has support for that been added?

Also, this is very important: [code is read much more than it is written](https://blogs.msdn.microsoft.com/oldnewthing/20070406-00/?p=27343) (Microsoft recommends not relying on something like Intellisense, that only helps when writing)

From the author of the Handbook of Agile Programming, Robert C Martin:

> “Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code. …[Therefore,] making it easy to read makes it easier to write.”

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 26, 2018, 11:29am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/115 "2018-01-26T11:29:19Z")

</div>

> [@ScottPJones](#):
>
> pulling up the Julia help for an operator or method in Emacs

Using my `julia-repl` mode, `C-c C-d` sends `@doc <symbol>` to the repl. Not as nice as a tooltip, but an OK solution until LanguageServer support matures.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 26, 2018, 11:55am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/116 "2018-01-26T11:55:55Z")

</div>

Oh, but that doesn’t work in the normal Julia editing mode (unless it was added in a later version).  
But that still doesn’t help readability, just like the article from the Microsoftie said, you shouldn’t have to rely on something like Intellisense to understand the code.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [January 27, 2018, 1:53am UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/117 "2018-01-27T01:53:55Z")

</div>

It’s worst that it looked. Not only `is_windows` is deprecated but we can’t do

```julia
julia> iswindows()
ERROR: UndefVarError: iswindows not defined

```

it has to be

```julia
julia> Sys.iswindows()
true

```

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 27, 2018, 4:49pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/118 "2018-01-27T16:49:55Z")

</div>

> [@jeff.bezanson](#):
>
> some people feel the removal of underscores has “gone too far”, but I don’t see many concrete suggestions.

Was allowing both ways considered? As Nim language allows; e.g. function cum\_sum

could be used as cumsum, or I believe cumSum (in Nim, but is there some Unicode case issue in general for such?).

Or other way, for function cumsum, making ok to add \_ arbitrarily, as we do for number literals, e.g. 1\_000\_000.

I see the downsides of not having consistency, but there could be a default way to show without \_ (that the user could override, to get to see, e.g. for this function):

```julia
help?> print_shortest
search: print_shortest

  print_shortest(io, x)

```

I also see: [Uniform Function Call Syntax - Wikipedia](https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax)

> proposed (as of 2016) for addition to C++ by Bjarne Stroustrup[5] and Herb Sutter[4]

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 27, 2018, 5:36pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/119 "2018-01-27T17:36:46Z")

</div>

> [@ScottPJones](#):
>
> is\_, has\_, get\_, set\_. Otherwise you end up with some that are a bit confusable if you don’t already know what they are, such as isqrt. There are also examples where mashing two words together can end up with something that looks bad, is\_hit looks a lot worse as ishit!

To be consistent you should want e.g. g\_c\_d function and arg\_max. How would you like if you could define functions e.g. “is hit” with \_ (or even, just [Non-breaking space - Wikipedia](https://en.wikipedia.org/wiki/Non-breaking_space) or any other that may be appropriate [Zero-width space - Wikipedia](https://en.wikipedia.org/wiki/Zero-width_space) or [Zero-width joiner - Wikipedia](https://en.wikipedia.org/wiki/Zero-width_joiner?))

and the REPL would not show the [zero-width]space but rather use alternating colors when showing code? And you could skip those invisible Unicode “letters” on use.

---

<div class="post-metadata">

**Author:** ![ScottPJones](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottpjones/32/146_2.png) [@ScottPJones](https://discourse.julialang.org/u/ScottPJones)\
**Post date:** [January 27, 2018, 5:46pm UTC](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549/120 "2018-01-27T17:46:19Z")

</div>

> [@Palli](#):
>
> To be consistent you should want e.g. g\_c\_d function

As I’ve said before, I believe underscores should be used consistently when separating _words_, but `gcd` is not a word, and also it is a standard mathematical function name, just like `sin`, `cos`, `tan`, so for two reasons it should not have underscores.

[Previous page](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549.md?page=5)

[Next page](https://discourse.julialang.org/t/naming-remove-all-underscores-to-matter-what/8549.md?page=7)
