I had a request. It would be nice if we could use class helpers with generic types like so:
type TArray<T> = array of T; StringArray = TArray<string>; IntArray = TArray<Integer>; type TArrayHelper<T> = record helper for TArray<T> private function GetLength: Integer; procedure SetLength(Value: Integer); public procedure Push(const Value: T); function Pop: T; property Length: Integer read GetLength write SetLength; end; StringArrayHelper = record helper(TArrayHelper<string>) for StringArray public function Join(const Separator: string): string; end; IntArrayHelper = record helper(TArrayHelper<Integer>) for IntArray public function Join(const Separator: string): string; end; var Values: IntArray; begin Values.Push(1); Values.Push(4); Values.Push(5); WriteLn(Values.Join(' | ')); // outputs '1 | 4 | 5' end.
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal