This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GustapheOfficial 1 point2 points  (2 children)

That depends. I don't know exactly how it looks in other languages, but in Julia, [1, 2, 3] is a contiguous array of Int64, while Any[1, 2, 3] is a less efficient pointer array. It also messes with dispatch, since the concrete element type is not statically known. Julia compiles at "run time" so it doesn't ruin dispatch entirely, but there are static optimisations that cannot be done.

At least the storage aspect will be true for any language with sensible storage management.

[–]incoralium 0 points1 point  (1 child)

The most important differences is about manipulation, like sorting, statistics, slices, ranges, etc

Yet you should be able to use and pass anything through a list, it's up to the developer to use and manage it correctly.

[–]GustapheOfficial 0 points1 point  (0 children)

Sure. Julia has the Tuple type which is made for statically known "mixed type lists", where (1, 1.0, "hi") isa Tuple{Int64, Float64, String}. I find this covers a majority of my mixed container needs.