[fpc-devel] [] property overloads

Ben Grasset operator97 at gmail.com
Tue Jul 9 18:59:10 CEST 2019


On Tue, Jul 9, 2019 at 12:32 PM Ryan Joseph <genericptr at gmail.com> wrote:

> So do I need to open another bug report for for this out/var/constref
> stuff? We already have https://bugs.freepascal.org/view.php?id=28949 but
> that’s just about the overloading bugs.
>
> I think it needs to be something like var/out should be be blocked in
> properties (unless VARPROPSETTER is on?) and constref should be allowed.
> Please confirm if that’s correct and I’ll make another bug report.
>

Well, I just checked, and with "out" and "var" for a getter with an array
property it actually doesn't compile if you pass a literal. Which is good
as at least it behaves logically.

That said, I'm unsure why setters need a directive, but getters do not.
(Even constref works fine, with no directives, currently, for getters.)

If anything, what would make the most sense is to just have a {$VARPROP}
directive that enabled all of the "by reference" stuff for both getters
*and* setters, while otherwise restricting them both to only "const",
"constref", or "unprefixed" parameters.

{$VARPROPSETTER} presumably needs to also be left as-is for Delphi
compatibility, but that's not really a big deal either way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190709/e0bd870d/attachment.html>


More information about the fpc-devel mailing list