[fpc-devel] Generics

Michael Van Canneyt michael at freepascal.org
Fri Aug 17 10:11:13 CEST 2007



On Fri, 17 Aug 2007, Florian Klaempfl wrote:

> Mattias Gaertner schrieb:
> > On Thu, 16 Aug 2007 23:31:25 +0200 (CEST)
> > Michael Van Canneyt <michael at freepascal.org> wrote:
> > 
> > > [...]
> > > > Why is the local variable block needed?
> > > It is not. I asked the same question. It was added for symmetry
> > > reasons: if a local type block is allowed, then a var block should
> > > also be allowed.
> > >
> > > But they are not different from local fields.
> > 
> > Strange. ok.
> > 
> > What local types are/will be allowed?
> > 
> > For example, this is currently not allowed:
> > 
> >   generic TTree<T> = class(TObject)
> >   type public   TTreeNode = specialize TNode<T>;
> >   end;
> > 
> > And this neither:
> > 
> >   generic TTree<T> = class(TObject)
> >   type public
> >     TTreeNode = class
> >       Data: T;
> >     end;
> >   end;
> > 
> > 
> > OTOH records and pointers are allowed.
> > Will this stay, or is this just not yet implemented?
> 
> Is there a need to support this?

Well, it seems rather strange that the type block would not allow all
possible types.

Michael.



More information about the fpc-devel mailing list