[fpc-pascal] Name of a var

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Nov 22 12:05:07 CET 2011



On Tue, 22 Nov 2011, Sven Barth wrote:

> Am 22.11.2011 10:13, schrieb michael.vancanneyt at wisa.be:
>>>> If we choose to implement such a function, yes. My response was based on
>>>> the compiler as it is.
>>> 
>>> Seems like I'm not the only one that likes to have such a function.
>>> Though I would extend it to convert identifiers in scope to strings
>>> (such as functions names etc.)
>> 
>> But what is the use ? As far as I can see, it forces you to type more.
>> 
>> Typing
>> 
>> VarName:=nameofvar( counter );
>> 
>> is more work than
>> 
>> VarName:='counter';
>> 
>> So what's the point ?
>
> The best argument for such a feature is that the name is checked by the 
> compiler. If I change the declaration of the variable the compiler will 
> complain in the first case, but not in the second (let's assume that we don't 
> need to care about some kind of backwards compatibilty, just because we wrote 
> the identifiers to a file in different versions of the application were the 
> variable had different names).

I beg you.... That's the most weak argument I've ever heard.

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.

Michael.



More information about the fpc-pascal mailing list