From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-03-21T17:41:21+09:00 Subject: Re: Proposal: new operator: '<-' (for assignments) In article <2003320223415.480988@PADD>, Austin Ziegler wrote: >On Fri, 21 Mar 2003 11:20:27 +0900, Phil Tomson wrote: >> Now of course, I could have allowed access to @val by declaring an >> attr_accessor, but in many cases I don't want to expose that >> information or make users of the class have to remember the name >> of the variable 'val'. It just seems much cleaner in many cases to >> have an assignment operator. Up till now I've been overriding '<<' >> to do this, but now I've run into a case where I'd like to pass on >> operators to the underlying value (@val in the example above) >> using method_missing so the underlying value can be shifted (and >> since '<<' is overriden, that's kind of tough). > >Array, String, and Hash use #replace to do this. > Perhaps, but I'm looking for an operator because: 1) it's shorter 2) the intent of '<-' is pretty clear (in fact it's often used for this in pseudocode) Phil