From: Robert Klemme Date: 2005-01-27T22:50:54+09:00 Subject: Re: Duping a class causes error "Trans" schrieb im Newsbeitrag news:1106832987.976217.139210@f14g2000cwb.googlegroups.com... > Maybe someone can offer me a possible reason for this. I have a set of > classes in a module called Markers. I have a module method, > Markers#list, that does nothing more than collects them into an array. > Then in my program when I do: > > | markers = Markers.list > > It works. But when I do: > > | markers = Markers.list.collect { |m| nm = m.dup ; nm } You can also do: markers = Markers.list.collect { |m| m.dup } > It does not work. > > I don't understand why. Obviously my initial thought is that something > about my Marker classes must not be shallow, but they're just classes, > made of methods and have no state, so I don't see how that can be. So Markers.list returns a list of class objects? > (Actually they do have a small bit of boolean state in a class instance > var, but I check and it is being duplicated.) > I just don't get it. Any ideas? What exactly goes wrong? robert