A named list of promises about some <T>, announced after the name.
interfaces.zg
# Interfaces (design/interfaces.md): a named list of promises about some <T>, announced after the name.interfaceOrdered<T>{op<['a':<T>,'b':<T>]->bool;opequal_to['a':<T>,'b':<T>]->bool;}interfacePrintable<T>{fnshow[lent'x':<T>]->str.utf8;}structVec{x:bin64,y:bin64}# a struct keeps a promise by having the operations — the language's own operators# may be defined for a user type (never for the language's types)op<['a':Vec,'b':Vec]->bool{return('a'.xtimes'a'.xplus'a'.ytimes'a'.y)<('b'.xtimes'b'.xplus'b'.ytimes'b'.y);}opequal_to['a':Vec,'b':Vec]->bool{return'a'.xequal_to'b'.xand'a'.yequal_to'b'.y;}fnshow[lent'v':Vec]->str.utf8{return"("++to.stored.str.utf8['v'.x]++", "++to.stored.str.utf8['v'.y]++")";}VecsatisfiesOrdered;# optional: a claim the compiler checksVecsatisfiesPrintable;# a generic says what its blank accepts where it announces it (owner, 2026-10-02)fnmax<T:Ordered>['a':<T>,'b':<T>]-><T>{if'b'<'a'{returngive'a';}# a <T> may be owned, so generic code writes the verbs;returngive'b';# for a plain T (int32) the verb does nothing}fndescribe<T:Printable>[lent'x':<T>]->str.utf8{return"value "++show[lend'x'];}MAIN{let'u':=Vec[x=1,y=2];let'v':=Vec[x=3,y=4];let'm':=max[copy'u',copy'v'];# Vec is Ordered: it has < and equal_to std::print.useful[describe[lend'm'],newln];std::print.useful[max[3,9]," ",max[2.5,1.5],newln];# numbers are Ordered by the languagestd::print.useful['u'equal_to'v'," ",'u'<'v',newln];# the operators work directly too}