On Tue, 22 Nov 2011, Rainer Stratmann wrote:
Am Tuesday 22 November 2011 10:13:20 schrieb michael.vancann...@wisa.be:
On Tue, 22 Nov 2011, Sven Barth wrote:
Am 21.11.2011 14:22, schrieb michael.vancann...@wisa.be:
On Mon, 21 Nov 2011, Rainer Stratmann wrote:
Am Monday 21 November 2011 14:08:43 schrieb michael.vancann...@wisa.be:
On Mon, 21 Nov 2011, Rainer Stratmann wrote:
Is it possible to get information of the name of a var?
For Example.
var
counter : longint;
varname : shortstring;
varname := nameofvar( counter );
The content of varname then is 'counter'.
There is no way in Pascal.
I think all the necessary information for this function are available.
The compiler knows the names of all vars. So why shouldn't it be
possible to
put the name in a shortstring?
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 ?
Compiler check of the name as Sven also mentioned. This check is very
important.
And as I answered, I can't possibly imagine why this would matter in the least.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal