> On Oct 15, 2019, at 6:13 PM, Michael Van Canneyt <mich...@freepascal.org> 
> wrote:
> 
> Of course there is: make the list the correct type. No typecasting needed 
> then.

I guess I’ll get used to it but we have lots of code like this (snippet I 
posted earlier from the parser):

   Declarations: TFPList; // list of TPasElement
   // Declarations contains all the following:
   Attributes, // TPasAttributes
   Classes,    // TPasClassType, TPasRecordType
   Consts,     // TPasConst
   ExportSymbols,// TPasExportSymbol
   Functions,  // TPasProcedure
   Properties, // TPasProperty
   ResStrings, // TPasResString
   Types,      // TPasType, except TPasClassType, TPasRecordType
   Variables   // TPasVariable, not descendants
     : TFPList;

where we have generic lists that we cast later to get the correct type. All 
these now are going to require new specializations for each class and changing 
the declarations. In fact this means using TFPList is not really a good idea at 
all anymore unless you don’t plan to use for..in loops. 

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to