[julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread Patrick O'Leary
On Wednesday, November 26, 2014 6:01:56 PM UTC-6, Test This wrote: I have the following function defined to check whether a record exists in a Mongodb database (thanks a million for PyCall, which make it easy to use pymongo to interact with mongodb in julia). function

[julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread Test This
Patrick, thank you for your response and the link. I will need to read it more carefully and try to understand as it since it deals with concepts I am not familiar with. However, wouldn't the solution you proposed restrict all values of the rec Dict to the same type in any given call. Am I

Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread K Leo
I ran into similar mental difficulty regarding whether type Any is a superset of any other types. I did not find anything to read, but simply accepted the fact through painstaking experiments. I think the word Any here is confusing. The English definition of it means that it ought to

Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread John Myles White
All types do have Any as a parent. It is clear that many people are confused about what covariance, contravariance and invariance mean in computer science. As such, I very strongly encourage everyone who isn't sure that they understand Julia's type system to read through the wikipedia article

Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread elextr
It is demonstrated in the manual at http://docs.julialang.org/en/release-0.3/manual/types/#parametric-composite-types that parametric types do not have any relationship even if their parameter types have some relationship. Perhaps it would be better emphasise that and to explain it simply

Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread K Leo
Thanks, now I understand it. The problem I had was this, which I imagine to exist with many other non-computer scientists new to Julia. This topic is discussed under the parametric type section of the manual, and since I had not attempted to use parametric types (the things with the

Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?

2014-11-26 Thread Ivar Nesje
The explanation that made me stop suggesting that `Sometype{T1} : Sometype{T2} if T1:T2` was the following function: function foo( a::Array{Any, 1}) # I can now get objects from the array, and they will be subtypes of Any b = a[1] # And I can insert Any object into the array