[fpc-devel] type classes

Peter Vreman peter at freepascal.org
Sun Oct 21 14:10:37 CEST 2007


At 14:03 21-10-2007, you wrote:
>On Sun, 21 Oct 2007 13:46:57 +0200
>Florian Klaempfl <florian at freepascal.org> wrote:
>
> > Mattias Gaertner schrieb:
> > > Is it possible to use TTranslateStrings = type TStrings?
> > > I ask because, the compiler allows it, but stops later with only
> > > this message:
> > > lcl/interfaces/gtk2/interfaces.pas(1,1) Fatal: Compilation aborted
> > >
> > > Question:
> > > Is it allowed to use
> > > NewClass = type SomeClass;
> > > ?
> >
> > In theory yes, in pratice it seems to be buggy :)
>
>Thanks for the quick response.

Also delphi handles things strange. The following code is from 
webtbf/tw3930a.pp. The code looks correct, but delphi fails with 
"Incompatible types: 'TMyStringList' and 'TStringList'". That makes 
typed classes not very usefull unless you override all constructors.


uses
   Classes;

type
   TMyStringList = type TStringlist;

var
   list : TMyStringList;

begin
   list:=TMyStringList.Create;
end.



Peter




More information about the fpc-devel mailing list