Discussion:
[fpc-pascal] Generic constants with generic type
Andrey Zubarev via fpc-pascal
2021-04-21 06:47:04 UTC
Permalink
Hi all!
With the existing syntax of constants, it is good to pass array boundaries,
but bad to initial parameter values. What do you think about such
constructs:

GTValue<GValueType; const GMin,GDefault,GMax:GValueType>=...
Sven Barth via fpc-pascal
2021-04-21 09:12:35 UTC
Permalink
Post by Andrey Zubarev via fpc-pascal
Hi all!
With the existing syntax of constants, it is good to pass array
boundaries, but bad to initial parameter values. What do you think about
GTValue<GValueType; const GMin,GDefault,GMax:GValueType>=...
It is currently simply not possible to reference earlier type parameters
inside the parameter clause. This affects code like this as well: generic
TSomeGeneric<T; S: ISomeOtherGeneric<T>>
Once that is fixed your case will probably work as well as long as the type
is one for which untyped constants can be declared.

Regards,
Sven
Andrey Zubarev via fpc-pascal
2021-04-21 15:59:45 UTC
Permalink
Ok. Thanks!
For this already there is a bug report? to notice when it will work?

On Wed, Apr 21, 2021 at 2:12 PM Sven Barth via fpc-pascal <
Post by Sven Barth via fpc-pascal
Post by Andrey Zubarev via fpc-pascal
Hi all!
With the existing syntax of constants, it is good to pass array
boundaries, but bad to initial parameter values. What do you think about
GTValue<GValueType; const GMin,GDefault,GMax:GValueType>=...
It is currently simply not possible to reference earlier type parameters
inside the parameter clause. This affects code like this as well: generic
TSomeGeneric<T; S: ISomeOtherGeneric<T>>
Once that is fixed your case will probably work as well as long as the
type is one for which untyped constants can be declared.
Regards,
Sven
Post by Andrey Zubarev via fpc-pascal
_______________________________________________
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Sven Barth via fpc-pascal
2021-04-21 17:26:18 UTC
Permalink
Post by Andrey Zubarev via fpc-pascal
Ok. Thanks!
For this already there is a bug report? to notice when it will work?
Best keep an eye on this one and then test again once it's solved:
https://bugs.freepascal.org/view.php?id=25678

Regards,
Sven
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
https://lists.free

Loading...