On Sun, 21 Oct 2007 14:10:37 +0200 Peter Vreman <[EMAIL PROTECTED]> wrote:
> At 14:03 21-10-2007, you wrote: > >On Sun, 21 Oct 2007 13:46:57 +0200 > >Florian Klaempfl <[EMAIL PROTECTED]> 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. It might sound strange, but this 'incompatible types' is good. I need it only for RTTI. A TMyStringList will never be created. Basically I need type TTranslateStringsText = type TStrings; TMyComponent = class(TPersistent) ... published property Items: TTranslateStringsText read ... write ...; end; The implementation will always use TStrings, not TTranslateStringsText. Only the RTTI information should show TTranslateStringsText. Especially this must work: Items:=TStringList.Create; BTW, I don't know what other sense is in 'type someclass'. Maybe Borland thought the same. Mattias _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel