Pair is defined as

immutable Pair{A,B}
    first::A
    second::B
end

, so it is type specialized with two parameters A and B.

Pair has its own syntax key => value and is used extensively with dicts.

Ivar

onsdag 4. februar 2015 19.58.42 UTC+1 skrev Seth følgende:
>
> I stumbled across Pair by accident and didn't find anything in the way of 
> docs, so I started playing with it and looking at the source.
>
> I can't figure out what the use case might be. It doesn't appear to be 
> type-optimized; that is, it doesn't use type parameterization to provide 
> speed/efficiency gains. It appears to allow Any=>Any, which I guess might 
> be useful, but I don't see how it might be better than a tuple. Using it in 
> lieu of an explicit type such as 
>
> immutable Edge
>     src::Int
>     dst::Int
> end
>
> results in (my) code being an order of magnitude slower - I assume it's 
> because I've specified the types of the members.
>
> What is the intended use case for the Pair type, and did I miss the 
> documentation?
>
>

Reply via email to