From: dblack@... Date: 2006-11-02T00:00:30+09:00 Subject: Re: variable pointer HI -- On Wed, 1 Nov 2006, akbarhome wrote: > @c = "donal" > @b = @c > > abrakadabra(@b, @c) > > @c = "mickey" > > print @b resulted "mickey" > > Is there something like abrakadabra method in ruby? The only thing I > can think to emulate this is using global variable. It was recently noted on the Rails mailing list that something like that happens in ActiveRecord. Given Person and Address models, where Person has_one Address: a = person.address person.address = Address.find(some_other_address) puts a # a has changed! I find it un-Rubyish and disconcerting (though I'm still waiting for someone to explain the rationale; there may be something I'm missing). I think you have to work pretty hard to get that to happen. Now and then there's a vogue for "become", which might do something like this (i.e., change all references), though not with assignment syntax. David -- David A. Black | dblack@wobblini.net Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org