Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-08 Thread Marco van de Voort
On Sun, Nov 08, 2009 at 12:17:35AM +, Howard Page-Clark wrote: On Sat, 7 Nov 2009, Marco van de Voort wrote: This is not orthogonal. VAR parameters are generally updated instantaniously. By delaying the update over a temp variable you break another aspect of the VAR parameter. I

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Mattias Gaertner
On Sat, 7 Nov 2009 13:44:39 +1000 Alexander Klenin kle...@gmail.com wrote: [...] 2) However, there is an obvious room for improvement here: not only Inc/Dec, but any procedure accepting var parameter should be able to accept writeable property of the same type. Var parameters must fit exactly

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Graeme Geldenhuys
2009/11/7 Marc Weustink m...@dommelstein.net: At that time I proposed this too and there was a valid reason not to generate such code. And that valid reason would be? I agree with Alexander and Mattias, why can't the compiler generate such code behind the scenes? -- Regards, - Graeme -

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Vincent Snijders
Graeme Geldenhuys schreef: 2009/11/7 Marc Weustink m...@dommelstein.net: At that time I proposed this too and there was a valid reason not to generate such code. And that valid reason would be? I agree with Alexander and Mattias, why can't the compiler generate such code behind the scenes?

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: At that time I proposed this too and there was a valid reason not to generate such code. And that valid reason would be? I agree with Alexander and Mattias, why can't the compiler generate such code behind the scenes? IMO such code (with temporary variables) is

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Hans-Peter Diettrich
Alexander Klenin schrieb: The answer was that properties are meant to change the value on the object immediately. Also a property setter can raise an exception, or additional actions can take place or the value can be substituted All this wouldn't happen with a temp variable (or at best

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Hans-Peter Diettrich
Martin schrieb: Inc(MyObj.MyIntProperty); = var temp: Integer; begin temp := MyObj.MyIntProperty; Inc(temp); MyObj.MyIntProperty := temp; end; Of course, if the compiler determines that the property is an alias for a field, it is free to pass the field directly -- but this is only an

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Martin
Alexander Klenin wrote: On Sat, Nov 7, 2009 at 14:15, Martin laza...@mfriebe.de wrote: The answer was that properties are meant to change the value on the object immediately. Also a property setter can raise an exception, or additional actions can take place or the value can be

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Alexander Klenin
On Sat, Nov 7, 2009 at 23:24, Hans-Peter Diettrich drdiettri...@aol.com wrote: Alexander Klenin schrieb: Using temporary variables, there will be one call to each. Where would you place such temporary variables, in your sample code? Into an invisible layer between the caller and MyInc2?

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Michael Van Canneyt
On Sat, 7 Nov 2009, Marco van de Voort wrote: On Sat, Nov 07, 2009 at 01:44:39PM +1000, Alexander Klenin wrote: 1) The change was correct in the sense that all properies should be treated begin temp := MyObj.MyIntProperty; Inc(temp); MyObj.MyIntProperty := temp; end; Of course, if the

Re: [Lazarus] Passing properties as var paramatars (was: Delphi editor clone)

2009-11-07 Thread Alexander Klenin
On Sun, Nov 8, 2009 at 03:07, Michael Van Canneyt mich...@freepascal.org wrote: On Sat, 7 Nov 2009, Marco van de Voort wrote: This is not orthogonal. VAR parameters are generally updated instantaniously. By delaying the update over a temp variable you break another aspect of the VAR parameter.