From: "David A. Black" Date: 2004-11-15T08:52:21+09:00 Subject: Re: OpenStruct#update ? Hi -- On Mon, 15 Nov 2004, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: OpenStruct#update ?" > on Mon, 15 Nov 2004 06:27:51 +0900, "David A. Black" writes: > > |I'm assuming so. Actually here's what happens if you try: > | > | irb(main):020:0> o = OpenStruct.new > | => > | irb(main):021:0> o.class = 1 > | => 1 > | irb(main):022:0> o.class > | => OpenStruct > > I'm thinking of making OpenStruct raise error for assignment to > existing method. I'm not sure whether I should prohibit private > method overriding, i.e. cases Hal pointed out in [ruby-talk:117889]. What about =-methods? require 'ostruct' def x=(y) puts "In x=()" end self.x = 1 # In x=() o = OpenStruct.new o.x = 1 # Should this print "In x=()" ? Probably a marginal case :-) David -- David A. Black dblack@wobblini.net