[fpc-devel] Templates / Generics

Bram Kuijvenhoven bram at kuijvenhoven.net
Mon Nov 7 13:37:33 CET 2005


Peter Vreman wrote:
> The token-lookahead is a hack and will create more problems and
> performance loss in a critical part of the compiler.
> 
> The restriction of type blocks only is not strange at all, Delphi allows
> 'class of' is also only in type blocks

Ok, I didn't know it would be a real ugly hack. And you are right about the 'class of'. It is in fact very similar, as we can extend the conventions regarding naming as follows:

type
  TMyObject = class ... end;

  TMyObjectClass = class of TMyObject;
  TMyObjectList = TList<TMyObject>;
  TMyObjectSet = TSet<TMyObject>;
  TStringMyObjectMap = TMap<string, TMyObject>;

etc.

One more question: If I understand it correctly, the parser uses a recursive top-down recursive descent approach and not a bottom-up approach like the LALR parsers generated by the pyacc tool?

Bram



More information about the fpc-devel mailing list