[fpc-devel] Thoughts on being able to declare "pointer-to-type" parameters directly in method signatures?
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Mon Jun 10 06:15:10 CEST 2019
On Sun, Jun 9, 2019 at 10:52 PM Ben Grasset <operator97 at gmail.com> wrote:
> On Sun, Jun 9, 2019 at 10:28 PM Dmitry Boyarintsev <
> skalogryz.lists at gmail.com> wrote:
>
>> So if you're fan of having ^Integer as a parameter type, then you pretty
>> much self-declaring to be a fan of (^Integer)(varname) as well.
>>
>
> This is.... completely ludicrous, to say the very least. "PSomething:
> ^TSomeType" declared in a method signature would behave *completely
> identically in every way *to how "var PSomething: ^TSomeType" *already
> behaves right now*, as far as using it inside the scope of the method
> body is concerned. It introduces *nothing* that does not already exist.
>
> The functionality I'm suggesting is *utterly trivial. *If you don't think
> so, it's likely you don't really quite get what I'm actually talking about.
>
You've been told before. Variable types are not the same as parameter types.
The "utterly trivial" is in fact a change to the language syntax.
Where currently, a parameter is:
[modifier] parameter_name [ : [array of] {type_identifier, const}]]
You're proposing to do it as:
[modifier] parameter_name [ : [array of] {[^]type_identifier, const}]]
treating "^" as a special rule to pass a reference to a type (because "^"
cannot be a part of identifier).
Adding a new exception never hurts anyone.
thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190610/3517d1d3/attachment.html>
More information about the fpc-devel
mailing list