[fpc-pascal] Generics feature status

Anthony Walter sysrpl at gmail.com
Fri Apr 29 21:55:48 CEST 2011


Is this true? I'd really like to see generics that with a mode where it is
possible to say with the following syntax (compatible with Delphi):

type
  IDelegate<T> = interface
    procedure Add(const Handler: T);
    procedure Remove(const Handler: T);
  end;

And then specialize using the following syntax:

type
  INotifyDelegate = IDelegate<TNotifyEvent>;

Also, generic constraints are needed:

type
  TComponentTool<T: TComponent> = class(TObject)
  public
    procedure DoSomething(const C: T);
  end;

On Fri, Apr 29, 2011 at 3:28 PM, leledumbo <leledumbo_cool at yahoo.co.id>wrote:

> I see now that generics have improved a lot since latest release, we even
> have Delphi compatible syntax in Delphi mode. Recursive generic type is
> supported as well now (finally, I can continue my data structure library
> :)). Seeing these facts, what's the status of this feature now? Is it
> considered stable?--
> View this message in context:
> http://free-pascal-general.1045716.n5.nabble.com/Generics-feature-status-tp4359580p4359580.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110429/57c1cbe9/attachment.html>


More information about the fpc-pascal mailing list