to clarify, (i hope):

`==` compares values. 
    
    
    let a = 99 #99 is in some slot in memory (a.addr)
    let b = 99 #99 is in another slot in memory (b.addr)
    a == b # true, the value in slot a is the same as the value in slot b
    
    
    Run

`==` compares values even for refs 
    
    
    type A = ref object
      x:int
    let a,b = A(x: 99) #create two A(x: 99)'s somewhere in memory and put their 
addresses in a and b.
    let c = a #put the value of a (the memory location of the first A(x: 99)) 
into c
    echo c==a #is the value of c equal to the value of a? yes, they both 
contain the same address
    echo c==b #is the value of c equal to the value of b? no, they refer to 
different A's
    echo c[]==b[] #is the value referred to by c the same as the value referred 
to by b? yes! c.x==b.x
    c.x = 97
    assert a.x==97 #changing c changed a as well, they are two references to 
the same object
    
    
    Run

Reply via email to