C = λ( self ).P( self ) \with {b = true,\Y(P) : τ where τ = μα.{i:int, eq:α→ bool}
eq = λ(o).(o.i = self.i and
o.b = self.b)
}
C = λ( self ).P( self ) \with {b = true,\Y(P) : τ where τ = μα.{i:int, eq:α→ bool}
eq = λ(o).(o.i = self.i and
o.b = self.b)
}
P = Λ α \leqslant F[α].λ( self: α).{…}with recursive types
C = Λ α \leqslant G[α].λ( self:α).P[α]( self ) \with {…}
Eiffel
class C inherit P redefine eq feature b : Boolean is true; eq( other : like Current ) : Boolean is begin Result := (other.i = Current.i) and (other.b = Current.b) end end C
p,v:P, c:C v:=c; v.eq(p);error p has no b
class C : public P {int b; public: C() { ... } bool eq(C& other) { return other.i == i && other.b == b; } bool eq(P& other) { return other.i == i; } };
C++