type ConceptAttribute = class(System.Attribute) end; IsConceptParameterAttribute = class(System.Attribute) end; ExplicitModelAttribute = class(System.Attribute) end; (* [Concept] SumTC = abstract class public constructor; begin end; function sum(v1, v2: T): T; abstract; end;*) SumTC[T] = typeclass function sum(v1, v2: T): T; end; (* SumTC_Integer = class(SumTC) public constructor(); begin end; function sum(v1, v2: Integer): Integer; override; begin Result := v1 + v2; end; end;*) SumTC[integer] = instance function sum(v1, v2: integer): integer; begin Result := v1 + v2; end; end; (* ConceptSingleton = class where T: constructor; class _instance: T; class inited: boolean := false; public class function &Instance: T; begin if inited = false then begin inited := true; _instance := new T; end; Result := _instance; end; end;*) function Sum3(v1, v2, v3: T): T; where SumT: SumTC, constructor; begin var s := __ConceptSingleton&.&Instance; Result := s.sum(v1, s.sum(v2, v3)); end; begin write(Sum3&(1, 2, 3)); end.