[fpc-pascal] Get variable name at runtime

Marco van de Voort marcov at stack.nl
Wed Mar 6 14:11:40 CET 2013


In our previous episode, John Lee said:
> So, why can't we have a get_name() type routine, so everyone can use it,
> not just those who can write pascal macros? J

The proposed Get_name only makes sense for logging purposes. Since if you
can't resolve the gotten string back to an address, it is pretty useless
for other things.

So basically all it is good for is

  log(get_name(x)+' : '+inttostr(x));

like constructs. since this 

1)    s:=get_name(x);
2) pass s to a different procedure
3) use s to get access to x in the different procedure

won't work.

>From what I quickly saw while quickreading this discussion, is that the
different proponents have different objectives, and don't seem to realize
it.



More information about the fpc-pascal mailing list