On 5/5/07, John Joyce <dangerwillrobinsondanger / gmail.com> wrote:
>
> On May 6, 2007, at 6:15 AM, Tim Hunter wrote:
>
> > John Joyce wrote:
> >> Suppose I have an object :
> >>
> >> a = 3
> >>
> >> I want to output the name a and the contents 3
> >> Outputing the contents is no problem.
> >> Is  there a method to output the name of the variable (object)
> >>
> > There's no way to do this in general.
> > Why don't you describe what you're trying to do? Maybe somebody can
> > suggest an alternative.
>
> What I'd like to do is similar to the idea of processing files and
> outputing results with names of files.
> I want to do the same with objects.
> I wrote an little code block just to talk back to me and tell me if
> an object is tainted or not. ("I'm making it plain English sentences,
> rather than simply true or false)

John,

This is a common stumbling block for a lot of folks who haven't seen
a uniformly object oriented language.

I've written about this a bit in my blog some time ago,
http://talklikeaduck.denhaven2.com/articles/2006/09/13/on-variables-values-and-objects

Variables are just names for objects, and aren't properties of the
objects themselves.  Objects don't know what folks are calling them.
Imagine that you have a secret admirer, she calls you 'that cute guy
who lives down the street.' but you don't know that.  Some guy who
likes her calls you 'that jerk who she thinks is cute.'  You don't
know about either of those 'names' but they both refer to you in
particular contexts.

I've been meaning to write a series of articles about variables in ruby.

It's just a question of finding the time.

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/