Ok, but they are indeed two separate instances of GapAnchor as indicated by
the pointer?
On Sunday, April 26, 2015 at 4:12:01 PM UTC+1, Kristoffer Carlsson wrote:
>
> An immutable is *only* defined by its values. This works just the same as
> say floats:
>
> julia> b = 156.123
>
> 156.123
>
> julia> a = 156.123
> 156.123
>
> julia> pointer_from_objref(b)
> Ptr{Void} @0x0000000006e73a70
>
> julia> pointer_from_objref(a)
> Ptr{Void} @0x0000000006e741e0
>
> julia> a === b
> true
>
>
>
> On Sunday, April 26, 2015 at 4:48:23 PM UTC+2, Ben Ward wrote:
>>
>> I've written a simple immutable type and I'm a little confused by some
>> behaviour I've seen:
>>
>> immutable GapAnchor
>> gapPos::Int
>> seqPos::Int
>> end
>>
>> function Base.copy(src::GapAnchor)
>> return GapAnchor(src.gapPos, src.seqPos)
>> end
>>
>> a = GapAnchor(5, 9)
>>
>> GapAnchor(5,9)
>>
>> b = copy(a)
>>
>> GapAnchor(5,9)
>>
>> a == b
>>
>> true
>>
>> a === b
>>
>> true
>>
>> is(a, b)
>>
>> true
>>
>>
>> I'm a bit confused as to why '===' would return true for a and b when it
>> is supposed to check if two variables point to the same thing in memory,
>> and copy constructs a new GapAnchor.
>>
>