From: David King Landrith Date: 2004-04-03T04:43:57+09:00 Subject: Re: Variable names On Apr 2, 2004, at 11:31 AM, ts wrote: >>>>>> "D" == David King Landrith writes: > > D> Is there any way to access the name of a given variable instance > from > D> within it? In other words, for any object x, is there C function to > D> which I can pass self to determine that the program calls it 'x'? > > Well, with this > > a = b = 12 > which is the name associated with the object 12 ? From what I understand, since 12 is a FixNum, a and b end up being separate FixNum objects with their own separate values of 12. But this strikes me as beside the point. In the C api, each function gets passed a pointer to the struct which represents self. You can pass this pointer to any number of functions to get information about self; e.g., class along with variables and their contents. So that for the FixNum 'a' above, we could discern that it was a FixNum. The question is: Is there a method that wil tell me that it is called 'a'. If 'self' end up being a literal, then I suppose its name is its value, but it seems to me that this would simply be a question of how the interpreter works vis a vis its symbols table. ------------------------------------------------------- David King Landrith (w) 617.227.4469x213 (h) 617.696.7133 Life is tough. It's even tougher if you're an idiot. --John Wayne ------------------------------------------------------- public key available upon request