From: "Peña, Botp" Date: 2005-05-06T16:46:09+09:00 Subject: Re: object reference handle (like perl's reference to scalar) dave.burt@gmail.com [mailto:dave.burt@gmail.com] wrote: #This is not possible, unfortunately. #In Ruby, # fname = "Eric" #is just an assignment to a local variable. There are no method #calls involved, and nothing to intercept. Thanks for the enlightenment, dave. I was narrowly thinking on pure object-oriented-ness.. # #You can, of course, go even further and remove the =, leaving: # fname "Eric" i'm happy w =. It's more like a "replace" and clearer for me.. How about := ? (Remembering pascal...) fname := "Eric" It looks/means much better/clearer. ## Please add the following line to the top of ref.rb: #require 'delegate' # ## on with the example #require 'ref' # #hacker = ["bot","pen","a",5,10].map{|x|x.ref}.ref # #name = hacker[0..2] #fname = name[0] #lname = name[1] #mname = name[2] # #height = hacker[3..4] #feet = height[0] # I corrected an off-by one here #inches = height[1] # and here # #fname[] = "Eric" # or like this: fname.ref = "Eric" #lname[] = "Mahurin" #mname[] = "?" # #feet[] = 6 #inches[] = 5 # #p name #=> ["Eric","Mahurin","?"] #p height #=> [6,5] #p hacker #=> ["Eric","Mahurin","?",6,5] # thanks. btw, where can i get your delegate.rb? thanks and kind regards -botp