[fpc-devel] Thoughts on being able to declare "pointer-to-type" parameters directly in method signatures?

Sven Barth pascaldragon at googlemail.com
Fri Jun 7 21:43:57 CEST 2019


Am 07.06.2019 um 21:06 schrieb Ben Grasset:
> On Fri, Jun 7, 2019 at 2:35 PM Jonas Maebe <jonas at freepascal.org 
> <mailto:jonas at freepascal.org>> wrote:
>
>     None of these can be defined as a type in parameter lists. Keep in
>     mind
>     that "^Type" defines a new type. Semantically, it's at the same
>     level as
>     "0..5" and "record a, b: longint end;".
>
>
> Right, that's the point. There's nothing else that *would* make any 
> syntactic sense in a parameter list besides "^Type" that isn't already 
> allowed in them.
No, I think you *missed* the point. "^Type" defines a new type. "0..5" 
defines a new type. "set of (Alpha, Beta, Gamma)" defines a new type. 
"record a, b: longint end" defines a new types. All four of these can be 
used either to declare a named type or for an anonymous type in a 
variable declaration. However none of these can be used in a parameter 
declaration. Parameter declarations and variable declarations are 
different beasts, they have different rules (for example you can't 
declare open arrays outside of parameter declarations and no, dynamic 
arrays don't count, cause despite them sharing a syntax dynamic arrays 
and open arrays are different concepts).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190607/520ee3a8/attachment.html>


More information about the fpc-devel mailing list