I always wondered, why is there no generic Hash in stdlib like:
    
    
    proc hash[T: object | ref object](o: T): Hash =
      var h: Hash = 0
      for k, v in o.fieldPairs:
        h = h !& v.hash
      result = !$h
    
    
    Run

Reply via email to