Parsetree.expression上的永久Hashtbl.hash冲突

Parsetree.expression上的永久Hashtbl.hash冲突,hash,ocaml,Hash,Ocaml,无论我在Exp.ident参数中输入什么,结果总是产生相同的哈希值。为什么呢 utop # Hashtbl.hash (Exp.ident {Location.txt=(Longident.Lident "bar");loc=Location.none}) ;; - : int = 99094472 utop # Hashtbl.hash (Exp.ident {Location.txt=(Longident.Lident "foo");loc=Location.none}) ;; - :

无论我在Exp.ident参数中输入什么,结果总是产生相同的哈希值。为什么呢

utop # Hashtbl.hash (Exp.ident {Location.txt=(Longident.Lident "bar");loc=Location.none}) ;;
- : int = 99094472 

utop # Hashtbl.hash (Exp.ident {Location.txt=(Longident.Lident "foo");loc=Location.none}) ;;
- : int = 99094472

utop # Hashtbl.hash (Exp.ident {Location.txt=(Longident.Lident "");loc=Location.none}) ;;
- : int = 99094472  

Parsetree.expression是否使用了某种无法由结构化哈希生成器遍历的神奇数据结构?

为了保证哈希始终终止,它具有最大深度。 当列表的开头相同时,也会出现同样的问题

如果这对您是必要的,一个好的解决方案是创建您自己的哈希函数,在Parsetree的情况下,我建议您看看