Types addPrototype: #Function derivedFrom: {Types Any}. "The Type of a low-level Function, with multiple arguments and returns." Types Function addSlot: #argumentTypes. Types Function addSlot: #resultTypes. function@(Types Function traits) representative [ [] ]. function@(Types Function traits) from: argumentTypes to: resultTypes "Returns a new parametrized Function type." [| newFunction | newFunction: function clone. newFunction argumentTypes: (argumentTypes as: Array). newFunction resultType: (resultTypes as: Array). newFunction ]. x@(Types Function traits) = y@(Types Function traits) [ x argumentTypes = y argumentTypes and: [x resultTypes = y resultTypes] ]. x@(Types Function traits) union: y@(Types Function traits) "Returns a new Type representing a Function over the union of the corresponding parameter Types. If the signature arities do not match, the Any type is returned." [ (x argumentTypes size = y argumentTypes size and: [x resultTypes size = y resultTypes size]) ifFalse: [^ Types Any]. x from: (x argumentTypes with: y argumentTypes collect: [| :t :u | t union: u]) to: (x resultTypes with: y resultTypes collect: [| :t :u | t union: u]) ]. x@(Types Function traits) intersection: y@(Types Function traits) "Returns a new Type representing a Function over the intersection of the corresponding parameter Types. If the signature arities do not match, the None type is returned." [ (x argumentTypes size = y argumentTypes size and: [x resultTypes size = y resultTypes size]) ifFalse: [^ Types None]. x from: (x argumentTypes with: y argumentTypes collect: [| :t :u | t intersection: u]) to: (x resultTypes with: y resultTypes collect: [| :t :u | t intersection: u]) ].