When should a function accept a symbol as an argument?

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

  1. Symbols are not deallocated in a single Julia session which means that they make sense if there is only a limited number of them (for ifs it is the case)
  2. Symbol is always treated as a whole (so string operation functions do not work on Symbols - you have to convert them to string first), which sometimes is a limitation
  3. Symbols 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.

5 Likes