On Sep 11, 2015 1:21 PM, "Alex M" <[email protected]> wrote: > > Thanks! > > Does it mean that now curly braces { } are not used anymore in the version 0.4? >
It is planned to be used for tuple types (not tuples themselves but their types) but that cannot happen before the deprecation period (0.4 release cycle) ends. > > On Friday, September 11, 2015 at 5:53:19 PM UTC+2, Yichao Yu wrote: >> >> On Fri, Sep 11, 2015 at 11:39 AM, Alex M <[email protected]> wrote: >> > Hello, >> > I am learning Julia. >> > >> > Both are arrays but of different types: >> > >> > julia> {} >> > 0-element Array{Any,1} >> > >> > julia> [] >> > 0-element Array{None,1} >> > >> > >> > julia> [] == {} >> > true >> > >> > Now I am trying to push new data : >> > >> > >> > julia> a = [] >> > julia> b = {} >> > >> > >> > julia> push!(a,"y") >> > ERROR: [] cannot grow. Instead, initialize the array with "T[]", where T is >> > the desired element type. >> > in push! at array.jl:457 (repeats 2 times) >> > >> > >> > But for [] it works: >> > >> > julia> push!(b,"y") >> > 1-element Array{Any,1}: >> > "y" >> > >> > >> > Also using {} I can create Dictionary: >> > >> > julia> {"a" => 3} >> > Dict{Any,Any} with 1 entry: >> > "a" => 3 >> > >> > >> > Now I am very confused. >> > >> > 1) What is the meaning of { } ? is it a dictionary constructor or an array >> > constructor of type Any ? >> >> It was `Any[]` for 0.3. Deprecated for 0.4 >> >> > 2) Why can't I push into [ ] ? >> >> Because the type is None. `[]` on 0.4 returns `Array{Any,1}` and that >> isn't a problem anymore. >> >> > >> > Thank you in advance!
