# Aliasing a function

**URL:** <https://discourse.julialang.org/t/aliasing-a-function/20359>\
**Category:** New to Julia\
**Created:** [February 1, 2019, 4:30pm UTC](https://discourse.julialang.org/t/aliasing-a-function/20359 "2019-02-01T16:30:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [February 1, 2019, 4:30pm UTC](https://discourse.julialang.org/t/aliasing-a-function/20359/1 "2019-02-01T16:30:01Z")

</div>

When using ImageView I find my fingers typing imview rather than imshow. So  
imview = imshow

And it works! Well why shouldn’t it? Once again pat on the back to the language designers.  
BTW, what is the technical term for this assignment? Alias is not the correct term.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [February 1, 2019, 4:33pm UTC](https://discourse.julialang.org/t/aliasing-a-function/20359/2 "2019-02-01T16:33:00Z")

</div>

Make sure you make it a `const`:

```julia
const imview = imshow

```

Whats wrong with calling this an alias?

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [February 1, 2019, 5:46pm UTC](https://discourse.julialang.org/t/aliasing-a-function/20359/3 "2019-02-01T17:46:37Z")

</div>

Interestingly, calling assignment “aliasing” might help people understand how it works in Julia since it makes it crystal clear that all you’re doing is causing two different names to refer to the same thing. Of course, it has a certain implication of permanence, which is not the case without `const`.

Note that you do really want that `const` here since otherwise the compiler is forced to pessimize all code surrounding a call to `imview` since it can’t know that the value and therefore the behavior won’t change at any moment (it could literally happen between any two non-inlined function calls).

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [February 3, 2019, 7:12am UTC](https://discourse.julialang.org/t/aliasing-a-function/20359/4 "2019-02-03T07:12:12Z")

</div>

@fredrikekre Thankyou @StefanKarpinski thankyou also. Your point _since it can’t know that the value and therefore the behavior won’t change at any moment_ of course chimes with the Julia type system. I read recently that optionally typed languages such as Python (\*) the compiler/interpreter must do the same thing - they type of a variable at any given time can change,

(\*) Really, really must stop picking on Pythons.
