Horacio Jamilis wrote:
I disagree with you. Most getter functions only do that, get the value without changing anything, but are functions because the resulting value is processed.
A property getter function, can, but should not, change anything.
Even if the getter changes something, it´s up to you, as a developer, to inspect such property or not... I use this every day on Delphi and, in my work, is an invaluable tool, that lazarus should have. May be, for people like you, in the debugger options page, could be an option to disable this funcionatility for tooltip debugging or for all the debugging, but this should be enabled by default.
The feature that is missing in lazarus is "function evaluation" and yes it is (yet) missing. As for how valuable it is, is a personal question. I rarely need it, some other people can not live without it.

As for "Most getter functions only do that, get the value ": I don't have delphi sources, I cannot check. But for example the property "Handle" afaik does change things (if no handle has been allocated it will do that, including requesting it from the OS).

And delphi is inconsistent in that.
 property Foo read GetFoo;

if i put "foo" and "getFoo" in my watches window, then:
- Foo is evaluated (despite the fact that "function evaluation" is NOT ticked on the watches property)
 If you ask me, it should *only* work, if explicit enabled.
- getFoo is not evaluated (correct because "function evaluation" is NOT ticked on the watches property)

So why is "Foo" evaluating a function, even so this is not enabled by the settings for this watch? That is a bug if you ask me, and a severe one, since it can thrash hours of debugging work. Oh yes, of course, I know when I add it as a watch. Actually I may do, but someone new to deplhi doesn't (I was once new to it too), so they get screwed...

And keep in mind, even a function that is not supposed to modify thinks can end up doing so. Evaluating the function, at a time the function was not meant to be called, may cause a crash, and may cause memory corruption..... There are plenty of hidden dangers, they may only occur in a few situations, but the can and will. And there is no warning at all, Simple pointing your mouse on a property (and getting hint evaluation) can destroy hours of debugging effort (again no warning...)

And if the property has a function that does modifications: if you put it in the watches and then run the hint too => you see different values (because they changed in between)

I agree "function evaluation" in the debugger can be a very helpful feature. That is it is helpful when used intentionally, sot the developer knows what side-effects may happen.
The way Delphi has it, doing it with no warning at all => very dangerous.


Best Regards
Martin


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to