# Inner and outer argument names

**URL:** https://discourse.julialang.org/t/inner-and-outer-argument-names/16247
**Category:** Internals & Design
**Created:** [October 12, 2018, 6:44pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247 "2018-10-12T18:44:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [October 12, 2018, 6:44pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/1 "2018-10-12T18:44:09Z")

</div>

Given the possibility to write a lot of generic functions, I am sometimes torn between giving function arguments a descriptive name and the desire to have short argument names for use in the function body.  
E.g.: Having `f(u,t,p)` instead of `f( state, time, parameters )`  
Swift has the notion of outer and inner names ( so `f( state:u, time:t, parameters:p )` ) with the possibility to have outer name `_` if it is not needed. This would also be nice for IDEs because they could show the function with its descriptive outer names.  
Personally I would like to see this in julia also and would love to hear your thoughts about it.  
As far as I see this is non-breaking.

---

<div class="post-metadata">

### Author: ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)
#### Post date: [October 12, 2018, 6:47pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/2 "2018-10-12T18:47:59Z")

</div>

You can choose arbitrary names of variables in the docstring for the function, so documentation and help in the repl could use descriptive names.

---

<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: [October 12, 2018, 7:19pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/3 "2018-10-12T19:19:10Z")

</div>

> [@BeastyBlacksmith](#):
>
> giving function arguments a descriptive name and the desire to have short argument names for use in the function body

I don’t think it could get simpler than

```julia
"""
$(DocStringExtensions.SIGNATURES)
"""
function f(state, time, parameters)
    u, t, p = state, time, parameters
    ...
end

```

---

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [October 12, 2018, 7:46pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/4 "2018-10-12T19:46:55Z")

</div>

So does the compiler optimize out the extra names? Or does it increase memory allocation?

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [October 12, 2018, 10:02pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/5 "2018-10-12T22:02:08Z")

</div>

In Julia, variables are just labels attached to values, and only values actually occupy memory, regardless of how many ways they have been labeled. In other words, this:

```julia
function foo(x)
  y = x
  z = x
  q = x
  return 2 * q
end

```

and this:

```julia
function foo(x)
  return 2 * x
end

```

are equivalent in their memory usage and performance.

---

<div class="post-metadata">

### Author: ![JeffreySarnoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeffreysarnoff/32/1980_2.png) [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)
#### Post date: [October 12, 2018, 11:12pm UTC](https://discourse.julialang.org/t/inner-and-outer-argument-names/16247/6 "2018-10-12T23:12:47Z")

</div>

Julia practice favors meaningful names that, while terse, are not obscure. [Naming/ShortForms.md at master · JuliaPraxis/Naming · GitHub](https://github.com/JuliaPraxis/Naming/blob/master/guides/ShortForms.md)

The marginal cost of additional keypressing is being weighed against the marginal benefit of working with more semantically transparent names. While any cost is unshared, the benfit (often) is shared. There is an accrual of value to the community in one case, and at best a non-dimunition of value in the other.
