[fpc-devel] Feature announcement: Generic type constraints
Marco van de Voort
marcov at stack.nl
Sun Dec 16 18:07:02 CET 2012
In our previous episode, Sven Barth said:
>
> I'm pleased to announce the addition of generic type constraints to Free
> Pascal (beginning from revision 23158).
Just FYI, last week I noticed Delphi isn't terribly succesful in working with
constraints in combination with forward defines:
{$apptype console}
uses generics.collections;
type
TLockedPool<t:class,constructor> = class
end;
TSerialCommand= class;
TSerialCommandPool = TLockedpool<TSerialCommand>;
TSerialCommand= class
name : string;
pool : TSerialCommandPool;
public
constructor create;
// procedure releasetopool;
end;
constructor tserialcommand.create;
begin
end;
begin
end.
Embarcadero Delphi for Win32 compiler version 24.0
Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
sometest.dpr(8) Error: E2513 Type parameter 't' must have one public
parameterless constructor named Create
sometest.dpr(21)
More information about the fpc-devel
mailing list