Remix.run Logo
dfawcus 2 days ago

> and there is no canonical way to document that A satisfies B

Surely that is wrong:

    package satisfy
    type I interface { foo(); }
    type S1 struct { a int; }
    type S2 struct { a int; }
    func (s *S1) foo() { s.a = 1; }
    var _ I = (*S1)(nil);
    var _ I = (*S2)(nil);
Then we get:

    $ go build ./satisfy.go 
    # command-line-arguments
    ./satisfy.go:7:11: cannot use (*S2)(nil) (value of type *S2) as type I in variable declaration:
         *S2 does not implement I (missing foo method)