On 23/07/2010 02:46, Paul Ishenin wrote:

What to do with the generics syntax? FPC do this so:

  generic TFPGList<T> = class(TFPSList)
  type public
    TCompareFunc = function(const Item1, Item2: T): Integer;
  var protected
    FOnCompare: TCompareFunc;
    function  ItemPtrCompare(Item1, Item2: Pointer): Integer;
  public
    constructor Create;
  end;
even in this example, the standalone "public" ends the type ?


while Delphi do so:

  TSomeClass = class
  public
   type
     TCompareFunc = function(const Item1, Item2: T): Integer;
   protected
    var
     FOnCompare: TCompareFunc;

Don't know which one is best. but IMHO there are 3 ways that could make sense:


1) type, const, ... are nested inside the visibility
They end with the visibility => same as they end with the end of an interface section...

2) visibility sections are nested inside type, const
honestly, not a good idea

3) combined keywords (IIRC harder to implement if the parser may have to look ahead) then inside a class "var" can not stand alone, but only iof followed by a visibilty modifier....


_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to