[fpc-pascal] Generics and Scopes
African Wild Dog
paintedlycaon at gmail.com
Thu Nov 10 04:30:36 CET 2016
2016-11-07 14:15 GMT-02:00 Sven Barth <pascaldragon at googlemail.com>:
> Am 07.11.2016 15:58 schrieb "African Wild Dog" <paintedlycaon at gmail.com>:
> > It is intended to change such compiler behavior in the future? It is
> incompatible with Delphi and moreover it force us to break the
> encapsulation of the Generic types.
>
> I can't answer this without you providing an example that fails.
>
Sorry for the noise. Some of my classes were bad designed. They look like
this sample (Delphi XE 6 compiles):
==== CODE BEGIN ====
unit sample;
{$MODE delphi}
interface
type
TGenericRecord<T> = record
strict private
Interf: IInterface;
type
TMockIntfObject<T> = record // Nested generic declaration
end;
public
FValue: T;
procedure SetValue(Value: T);
end;
implementation
{ TGenericRecord<T> }
procedure TGenericRecord<T>.SetValue(Value: T);
begin
Interf := TMockIntfObject.Create;
end;
end.
==== END ====
With fpc i got the error "Fatal: Declation of generic class inside another
generic class is not allowed".
Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161110/d590b715/attachment.html>
More information about the fpc-pascal
mailing list