Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-11-13 Thread leledumbo
> Awesome. =) It is, though the syntax is still evolving, but initial decision about is what interests me as it differs a lot from C++. Delphi syntax seems to copy from C++ as is. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/Generic-specialization-using-mo

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-11-13 Thread silvioprog
On Tue, Nov 11, 2014 at 7:25 PM, Sven Barth wrote: > On 11.11.2014 22:48, silvioprog wrote: > >> Oh, sorry. Just: >> >> unit Core.Singleton; >> >> {$mode objfpc}{$H+} >> >> interface >> >> type >> >>{ TSingleton } >> >>generic TSingleton = class(TObject) >>public >> class functio

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-11-11 Thread Sven Barth
On 11.11.2014 22:48, silvioprog wrote: Oh, sorry. Just: unit Core.Singleton; {$mode objfpc}{$H+} interface type { TSingleton } generic TSingleton = class(TObject) public class function GetInstance: T; end; implementation { TSingleton } class function TSingleton.GetInstan

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-11-11 Thread silvioprog
On Tue, Nov 11, 2014 at 5:34 PM, silvioprog wrote: > On Sat, Nov 1, 2014 at 1:54 AM, leledumbo > wrote: > >> > Hm... so I'll choose the mode delphi in my new projects to type less >> code >> hehe... >> >> You actually ended up typing much less using objfpc style generics. Think >> of >> how many

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-11-11 Thread silvioprog
On Sat, Nov 1, 2014 at 1:54 AM, leledumbo wrote: > > Hm... so I'll choose the mode delphi in my new projects to type less code > hehe... > > You actually ended up typing much less using objfpc style generics. Think > of > how many angle brackets you would need to type in Delphi mode? And how many

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-10-31 Thread leledumbo
> Hm... so I'll choose the mode delphi in my new projects to type less code hehe... You actually ended up typing much less using objfpc style generics. Think of how many angle brackets you would need to type in Delphi mode? And how many if the specialized type changes? ;) Delphi generics can actua

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread silvioprog
On Fri, Oct 31, 2014 at 12:01 AM, Kiên Nguyễn Tiến Trung wrote: > AFAIK, you must create a new type: > > type > TMyGenericInt = specialize TMyGeneric; > var > VMyGenericInt: TMyGenericInt; > > begin > VMyGenericInt:= TMyGenericInt.Create; > VMyGenericInt.Value := 2014; > VMyGe

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread Kiên Nguyễn Tiến Trung
AFAIK, you must create a new type: type TMyGenericInt = specialize TMyGeneric; var VMyGenericInt: TMyGenericInt; begin VMyGenericInt:= TMyGenericInt.Create; VMyGenericInt.Value := 2014; VMyGenericInt.Free; end. 2014-10-31 2:14 GMT+07:00 silvioprog : > Hello, > > How to use t

[fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread silvioprog
Hello, How to use this code below in mode objfpc?: TMyGeneric = class(TObject) private FValue: T; public property Value: T read FValue write FValue; end; ... var VMyGenericStr: TMyGeneric; VMyGenericInt: TMyGeneric; begin VMyGenericStr := TMyGeneric.Create; VMyGenericStr