Why `Any` in `Any[func1, func2, func3, func4]`?

I’m reading the “Performance Tips” section of the official documentation. At the bottom of that section there’s a piece of code that baffles me a little:

julia> x = randn(10000);

julia> fmt(f) = println(rpad(string(f)*": ", 14, ' '), @elapsed f(x))

julia> map(fmt, Any[copy_cols, copy_rows, copy_col_row, copy_row_col]);
copy_cols:    0.331706323
copy_rows:    1.799009911
copy_col_row: 0.415630047
copy_row_col: 1.721531501

Is there any reason behind that Any?

Any[] used to be written as {}. This was changed in update manual for tuple type change · JuliaLang/julia@f96e33b · GitHub (4 years ago) and the codebase was probably regex search and replaced. You are right that it is not needed now. Feel free to open a PR to remove it.

3 Likes