2 ms·
> Putting a string in a Vector{Int64} is simply not allowed. In Java the same applies. But Java is a weird beast. While every value has a type, not all types a
by genman 3y ago
> Putting a string in a Vector{Int64} is simply not allowed.
In Java the same applies. But Java is a weird beast. While every value has a type, not all types are equal - there are primitive types like int and double, that are value types, and Integer and Double, that are class types. This all is even more muddied with class generics that are forced into the existing system by type erasure at compile time - so while you can't put a String into an array of Double, you definitely can put a String into a hash map of Double when you really want to, as the hash map is implemented as a class and type parameters of a class are just an illusion that is enforced during the compile time. No sane person will do this and uses all the available tricks to eliminate this possibility, but it is definitely possible.