From: "Mauricio Fernández" Date: 2004-01-20T04:54:29+09:00 Subject: Re: setting instance variable "dynamically" On Tue, Jan 20, 2004 at 01:55:00AM +0900, Robert Klemme wrote: > > it change also the class > > > > svg% ruby -e 'b = []; b.instance_eval { def a() puts "array"; end}; b.a' > > array > > svg% > > Well, but that is just a consequence of self pointing to another instance. > You could have achieved the same by doing: > > 17:50:29 [w]: ruby -e 'b = []; b.instance_eval { def self.a() puts > "array"; end}; b.a' > array [...] > Am I overlooking something? Guy is emphasizing the fact that this modifies the *singleton* class. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Linux poses a real challenge for those with a taste for late-night hacking (and/or conversations with God). -- Matt Welsh