# When should a function accept a symbol as an argument?

**URL:** <https://discourse.julialang.org/t/when-should-a-function-accept-a-symbol-as-an-argument/43510>\
**Category:** New to Julia\
**Tags:** question, metaprogramming, design\
**Created:** [July 22, 2020, 6:51pm UTC](https://discourse.julialang.org/t/when-should-a-function-accept-a-symbol-as-an-argument/43510 "2020-07-22T18:51:26Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [July 23, 2020, 9:17am UTC](https://discourse.julialang.org/t/when-should-a-function-accept-a-symbol-as-an-argument/43510/17 "2020-07-23T09:17:59Z")

</div>

Some comments (that are the consequences of what was already said):

1. `Symbol`s are not deallocated in a single Julia session which means that they make sense if there is only a limited number of them (for `if`s it is the case)
2. `Symbol` is always treated as a whole (so string operation functions do not work on `Symbol`s - you have to convert them to string first), which sometimes is a limitation
3. `Symbol`s that are not valid identifiers are relatively cumbersome to spell out (which matters in interactive use)

E.g. consideration of points 2 and 3 made us start accepting strings as column names in DataFrames.jl.

---

_[View the full topic](https://discourse.julialang.org/t/when-should-a-function-accept-a-symbol-as-an-argument/43510)._
