[fpc-pascal] Record Method and Operators
Florian Klaempfl
florian at freepascal.org
Wed Oct 22 15:36:30 CEST 2008
Cesar Romero schrieb:
> Hi,
>
> Im wondering if FPC Team have plans to support Record Methods/Operators
> in future versions of FPC
> I read the actual "Future plans" and the most closed item is "RTL:: More
> compatibility with later Delphi versions."
> But it do not means that records can be changed.
>
> I want to implement my ValueTypes using record with implicit operators
> and constructor/destructor, like this code written by a friend, Lee Nover.
>
> TSpecifier = record
> S: AnsiString;
> WS: WideString;
> Intf: IInterface;
>
> class operator Implicit(const S: AnsiString): TSpecifier;
> class operator Implicit(const C: Cardinal): TSpecifier;
> class operator Implicit(const D: Double): TSpecifier;
> class operator Implicit(const I: Integer): TSpecifier;
> class operator Implicit(const I64: Int64): TSpecifier;
> class operator Implicit(const V: TValue): TSpecifier;
> class operator Implicit(const WS: WideString): TSpecifier;
> class operator Implicit(const Intf: IInterface): TSpecifier;
>
> class operator Implicit(const Spec: TSpecifier): AnsiString;
> class operator Implicit(const Spec: TSpecifier): Cardinal;
> class operator Implicit(const Spec: TSpecifier): Double;
> class operator Implicit(const Spec: TSpecifier): Integer;
> class operator Implicit(const Spec: TSpecifier): Int64;
> class operator Implicit(const Spec: TSpecifier): TValue;
> class operator Implicit(const Spec: TSpecifier): WideString;
> class operator Implicit(const Spec: TSpecifier): IInterface;
>
> case NativeType: Integer of
> varInteger: (I: Integer);
> varInt64: (I64: Int64);
> varLongWord: (C: Cardinal);
> varDouble: (D: Double);
> varObject: (O: TValue);
> end;
>
> My plans is to have a single framework compatible with Delphi 2007/2009
> and FPC, so Ill not use some D2009 only resources, but implicit
> operators make the live of users very better to write less and better code.
>
> Can I have any hope about this subject?
What does it prevent you from using FPC's operator overloading
capabilities to do so which has FPC for 10 years?
More information about the fpc-pascal
mailing list