I think this is what your after (for Foo = Int and Bar = Float64):

julia> Tuple{Int,Float64}[]
0-element Array{Tuple{Int64,Float64},1}


julia> push!(ans, (1, 2.))
1-element Array{Tuple{Int64,Float64},1}:
 (1,2.0)

Documentation is unfortunately still in the process of being updated. 
 Basically, anywhere you had a tuple of types, you now must write 
`Tuple{Int, Float64}` instead of `(Int, Float64)`.  In cases where you had 
a vararg tuple specification, you now write `Tuple{Int, Vararg{Float64}}` 
instead of `(Int, Float64...)`.  That latter vararg syntax is still up for 
debate.

On the plus side, you no longer need to work around constructing tuples by 
splatting: (1, (2,3)…) now works as you would expect it to.  And there's no 
longer a strange type/value duality to ().

On Sunday, April 19, 2015 at 5:06:00 PM UTC-4, Seth wrote:
>
> Following up:
>
> How does one now write
>
> foo = (Foo, Bar)[]
>
> ?
>
> Sorry for all the questions here. I really don't understand the changes 
> that were made and I'd like to get my package working again as quickly as 
> possible.
>
> Are there docs anywhere (written for novices, that is) on what changed and 
> how to adapt?
>
>
> On Sunday, April 19, 2015 at 12:09:27 PM UTC-7, Tony Kelman wrote:
>>
>> That will cause the code to not work on 0.3. To get code that works on 
>> both 0.3 and 0.4, use the Compat.jl package, and
>>
>>      function _make_simple_undirected_graph{T<:Integer}(n::T, 
>> edgelist::Vector{@compat(Tuple{T,T})}) 
>>
>>
>> On Sunday, April 19, 2015 at 11:58:42 AM UTC-7, Avik Sengupta wrote:
>>>
>>>
>>> Try this: 
>>>
>>>      function _make_simple_undirected_graph{T<:Integer}(n::T, 
>>> edgelist::Vector{Tuple{T,T}}) 
>>>
>>> On Monday, 20 April 2015 00:18:33 UTC+5:30, Seth wrote:
>>>>
>>>> Could someone please explain what's going on here and what I need to do 
>>>> to fix my package with the latest 0.4 tuple changes?
>>>>
>>>> Here's the error (from pkg.julialang.org):
>>>>
>>>> ERROR: LoadError: LoadError: LoadError: TypeError: apply_type: in alias, 
>>>> expected Type{T}, got Tuple{TypeVar,TypeVar}
>>>>  in include at ./boot.jl:250
>>>>  in include_from_node1 at ./loading.jl:129
>>>>  in include at ./boot.jl:250
>>>>  in include_from_node1 at ./loading.jl:129
>>>>  in reload_path at ./loading.jl:153
>>>>  in _require at ./loading.jl:68
>>>>  in require at ./loading.jl:51
>>>>  in include at ./boot.jl:250
>>>>  in include_from_node1 at loading.jl:129
>>>>  in process_options at ./client.jl:299
>>>>  in _start at ./client.jl:398
>>>> while loading /home/vagrant/testpkg/v0.4/LightGraphs/src/smallgraphs.jl, 
>>>> in expression starting on line 120
>>>> while loading /home/vagrant/testpkg/v0.4/LightGraphs/src/LightGraphs.jl, 
>>>> in expression starting on line 93
>>>> while loading /vagrant/nightlyAL/PKGEVAL_LightGraphs_using.jl, in 
>>>> expression starting on line 4
>>>>
>>>>
>>>> Here's the line in question:
>>>>
>>>> function _make_simple_undirected_graph{T<:Integer}(n::T, edgelist::
>>>> Vector{(T,T)})
>>>>
>>>> I confess to not yet fully understanding the new change to tuples, and 
>>>> I'm lost as to how to fix my code to comply with the new rules.
>>>>
>>>> Thanks.
>>>>
>>>

Reply via email to