On Sat, Nov 29, 2014 at 5:55 PM, silvioprog <silviop...@gmail.com> wrote:
> On Sat, Nov 29, 2014 at 4:54 PM, Michael Van Canneyt < > mich...@freepascal.org> wrote: >> >> On Sat, 29 Nov 2014, silvioprog wrote: >> >>> On Sat, Nov 29, 2014 at 2:04 PM, Sven Barth <pascaldra...@googlemail.com> >>> wrote: >>> On 29.11.2014 16:54, silvioprog wrote: >>> Hello, >>> >>> Today I compiled my FPC from trunk and saw the following >>> possibility: >>> >>> >>> This feature is available since February 2013 already, you just >>> had to use {$modeswitch typehelpers} >>> (I even announced that on fpc-devel, fpc-pascal and fpc-announce >>> back then). What I committed >>> yesterday was simply to allow them by default in mode Delphi as >>> that mode is simply a collection of >>> features supported by the current Delphi version (in so far they >>> are already implemented in FPC). You >>> still have to use the modeswitch in other modes and in all modes >>> except the Delphi ones it's "type >>> helper" instead of "record helper". >>> >>> Regards, >>> Sven >>> >>> >>> Awesome. I'll use type helper. =) >>> >>> Plans to implement the currently XE helpers? (TIntegerHelper, >>> TStringHelper etc.) >>> >> >> Definitely, as soon as I find time. >> But initial patches welcome. >> >> Michael. > > > Nice. To implement it we can need to enable the {$modeswitch > typehelpers}. Can you enable it in SysUtils? > Just testing: unit sysutils; interface {$MODE objfpc} {$MODESWITCH OUT} {$MODESWITCH TYPEHELPERS} ... sysutilh.inc ... function GetModuleName(Module: HMODULE): string; type TGuidHelper = type helper for TGuid // class function Create(const B: TBytes): TGUID; overload; static; // class function Create(const S: string): TGUID; overload; static; // class function Create(A: Integer; B: SmallInt; C: SmallInt; const D: TBytes): TGUID; overload; static; // class function Create(A: Integer; B: SmallInt; C: SmallInt; D, E, F, G, H, I, J, K: Byte): TGUID; overload; static; // class function Create(A: Cardinal; B: Word; C: Word; D, E, F, G, H, I, J, K: Byte): TGUID; overload; static; // class function NewGuid: TGUID; static; // function ToByteArray: TBytes; // function ToString: string; end; ... sysutilh.inc(330,3) Error: Type "TGuid" cannot be extended by a type helper I'll leave this task to you. =D -- Silvio Clécio My public projects - github.com/silvioprog
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus