Adding properties into existing stabs/dwarf; gdb readable workaround ? [[Re: [fpc-devel] Status and ideas about debug info (stabs, dwarf / dwar3)]]
DaWorm
daworm at gmail.com
Tue Sep 13 21:41:29 CEST 2011
On Tue, Sep 13, 2011 at 8:52 AM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> [sorry to be harsh towards DaWorm, but that was a
> damn stupid example]
It was only an example intended to show that executing getters can
have unintended and sometimes disastrous and/or non reversible side
effects. By itself it might be a stupid thing to do, but the concept
that merely reading a property may actually change something else is
not stupid. Maybe your getter returns the next item in a pseudo
random sequence, who know what it does? The example wasn't the point:
that such an example is possible was the point. And you might not
have built such a thing consciously. Maybe you've descended from a
third party library routine that you may or may not have the source
code, for and that library does something you might not expect.
You may have the memory capacity to know that 15 levels deep there is
a property that is implemented by a getter with a side effect, but
that in this instance it is ok to run that getter in the debugger, but
I don't trust my memory that much. I can easily forget that this
property has a getter with a side effect and that one doesn't. That's
why I create objects in the first place, to hide all of those
implementation details once and for all, and concentrate on actually
getting things done.
I would not want any debugger to automatically execute such a property
getter. I wouldn't mind if it warned me with a dialog box or message
that this property has a getter defined by such and such method, and I
then had the option to go check it out first, then maybe check a box
or change a setting saying this is ok from now on, but I don't want it
to just go and do it on its own.
As for it not being a problem in Delphi, I don't automatically enable
that option. I doubt many others do either, at least not after
they've been bitten by it the first time. If I try to evaluate a
property and it doesn't it is fairly obvious why, and I go down the
inheritence chain until I find the getter and look at what it is
using. If it is harmless, then I might check the checkbox that says
to execute code to get the value, but it is the last thing I do, not
the first. Of course, maybe all of my code is bad like that example
and so I don't have any choice, and maybe all of your code is perfect
and you never have to worry about it. I'd say neither is totally
true.
Jeff.
More information about the fpc-devel
mailing list