[fpc-pascal] Name of a var
Rainer Stratmann
RainerStratmann at t-online.de
Tue Nov 22 14:18:11 CET 2011
Am Tuesday 22 November 2011 14:09:42 schrieb michael.vancanneyt at wisa.be:
> On Tue, 22 Nov 2011, Rainer Stratmann wrote:
> >>>> The name of a variable is only used for debugging, and then you can
> >>>> just as well use the debug info. And the change of a name is usually
> >>>> done with search&replace, option whole word, so the text 'counter'
> >>>> should get changed as well.
> >>>>
> >>>> The name of a variable is of absolutely no use to the end user.
> >>>
> >>> No that's not correct.
> >>> That is in my eyes an excuse not to deal with it.
> >>
> >> That depends entirely on the cost of this function. For example the use
> >> Graeme wants is not possible without adding a complete run-time
> >> environment a la .NET.
> >>
> >>> The search&replace function in lazarus is not the best.
> >>> I often change the name in the declaration and then see what the
> >>> compiler says. The compiler does not complain with the text 'counter'.
> >>> So then you may feel 'secure' but it is not.
> >>
> >> Once more: the name in the debug message is totally irrelevant.
> >> I would fire anyone RELYING on that.
> >
> > Are you sure that you are objective in this diskussion?
>
> As much as anyone else in this discussion ? :-)
>
> I just know daily practice; how I and my collegae debug apps.
> I can't for the life of me imagine why you would *rely* on such a feature.
>
> IMHO it adds only very marginal value: in the the case when you rename
> a variable, possibly a debug message will not reflect the name change.
> How marginal is that ?
>
> Doubly so, because in case the executable contains debug info, you can
> write the function yourself so it looks up the name in the debug info.
>
> But hey, if someone wants to implement this, why not. There are other
> things in FPC of which I personally do not see the added value...
It is not that I rely on such a feature. But - of course - when implemented I
would use it and it would be strange if this function then disappears.
Now I register every storable value in a list.
// pointer to val, name, alternative name when reading a file, initial value,
min value, max value
myregistervar( @counter , 'counter' , 'counteralt' , 10 , 5 , 200 );
myregistervar( @... , '...' , ... , ... , ... );
counteralt is the alternative name in case of changing the name of the
variable. In this case reading from the file does not get lost. But when
storing again in the file the new name is used. Ideally the name does not
change, but if you have a huge list that's also for the reason of simplicity
better to change the names sometimes.
I don't need all the debug info.
> Michael.
More information about the fpc-pascal
mailing list