On Thu, Mar 25, 2021 at 8:21 PM messi...@gmail.com <messi.sh...@gmail.com> wrote: > > While reading the source code of typechecker, I found there're two ways to > check type equality: > 1. Method checker.identical(x, y Type) bool {}, defined in predicates.go, > used by many places to see if two types are identical during typecheck > process; > 2. Method unifier.unify(x, y Type) bool {}, defined in unify.go, used by > method lookup to compare two Signature types > > And there's comment "For changes to this code the corresponding changes > should be made to unifier.nify." for method checker.identical0(). > > I wonder why there're two implementations for one thing? And if there're some > reason, why the name "unify"?
You are looking at the type checker on tip, which is in the process of being modified to support generics (https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md). This work is in progress and the code will continue to change. For type unification, see https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#type-unification. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXfwvz2bQ0Dg37-1_m%2BNhbM5goJj0t9Y%2BHGy9nwzw_gVg%40mail.gmail.com.