unit Myc.Data.Records; interface uses System.Generics.Collections, Myc.Data.Keyword, Myc.Data.Value; type // Runtime implementation for generic records using linear search (optimized for small record sizes) TDynamicRecord = class(TInterfacedObject, IKeywordMapping) private FFields: TArray>; function GetFields: TArray>; public constructor Create(const AFields: TArray>); function IndexOf(const Key: IKeyword): Integer; end; implementation { TDynamicRecord } constructor TDynamicRecord.Create(const AFields: TArray>); begin inherited Create; FFields := AFields; end; function TDynamicRecord.GetFields: TArray>; begin Result := FFields; end; function TDynamicRecord.IndexOf(const Key: IKeyword): Integer; begin // Linear search (O(n)). Fast enough for typical records. // Keyword comparison is integer-based (Idx), so this is efficient. for Result := 0 to High(FFields) do begin if FFields[Result].Key.Idx = Key.Idx then exit; end; Result := -1; end; end.