Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-06

Compiler error passing a Property as a parameter

5 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I think it was FPC 2.6.0 that changed the language rules about Properties. You can't pass them directly as a var parameter, can't assign to a property of a property etc.

Anyway, somebody recently asked my why this was implemented, and I can't actually remember the exact rational behind the FPC team's decision.

Does anybody have a link to the documentation or FPC discussion on this? I'm looking for info on what was so bad about the old behaviour etc. and if this was another Delphi compatibility change or not?

I want to pass this information on, but want to make sure I get it right.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email

Tomas Hajny
to Graeme Geldenhuys

On Sun, June 8, 2014 21:50, Graeme Geldenhuys wrote:

Hi Graeme,

Show quoted text 12 lines
I think it was FPC 2.6.0 that changed the language rules about Properties. You can't pass them directly as a var parameter, can't assign to a property of a property etc. Anyway, somebody recently asked my why this was implemented, and I can't actually remember the exact rational behind the FPC team's decision. Does anybody have a link to the documentation or FPC discussion on this? I'm looking for info on what was so bad about the old behaviour etc. and if this was another Delphi compatibility change or not? I want to pass this information on, but want to make sure I get it right.

Have you already checked the "User changes 2.x.0" pages of the respective releases (especially
http://wiki.freepascal.org/User_Changes_2.6.0#Taking_the_address_of_fields_of_record_properties and
http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields referenced from the previous one)?

Tomas

Reply by email

Vincent Snijders
to Graeme Geldenhuys: I think it was FPC 2.6.0 that changed the language rules about Properties. You can't pass…

2014-06-08 21:50 GMT+02:00 Graeme Geldenhuys
:

Show quoted text 14 lines
Hi, I think it was FPC 2.6.0 that changed the language rules about Properties. You can't pass them directly as a var parameter, can't assign to a property of a property etc. Anyway, somebody recently asked my why this was implemented, and I can't actually remember the exact rational behind the FPC team's decision. Does anybody have a link to the documentation or FPC discussion on this? I'm looking for info on what was so bad about the old behaviour etc. and if this was another Delphi compatibility change or not?

See reason:
http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields

Vincent

Reply by email

Michael Schnell
to Graeme Geldenhuys: I think it was FPC 2.6.0 that changed the language rules about Properties. You can't pass…
Graeme Geldenhuys wrote
You can't pass them directly as a var parameter,

I feel that generally passing a property as a var parameter is not possible,

It could be possible for built-in functions (such as inc() ) or for properties that don't have a set or get function.

Of course the compiler could detect these special cases. I don't know if it does make sense to handle them.

-Michael

Reply by email

Sven Barth
to Michael Schnell
"Michael Schnell" wrote 7 lines
On 06/08/2014 09:50 PM, Graeme Geldenhuys wrote: > > You can't pass them directly as a var parameter, I feel that generally passing a property as a var parameter is not

possible,

It could be possible for built-in functions (such as inc() ) or for

properties that don't have a set or get function.

Of course the compiler could detect these special cases. I don't know if

it does make sense to handle them.

If you would look at the wiki articles linked by others already which describe the changes and the reasoning behind them you'd know why we don't allow properties to be passed to var parameters anymore.

Regards,
Sven

Reply by email