From: Yukihiro Matsumoto Date: 2005-03-22T10:19:04+09:00 Subject: Re: RCR 296: Destructive methods return self Hi, In message "Re: RCR 296: Destructive methods return self" on Sun, 20 Mar 2005 07:27:33 +0900, Daniel Amelang writes: |Perhaps a more interesting solution would be to get rid of all |destructive methods and work on optimizing ther existing |non-destructive counterparts. Matz seems to prefer this solution. I don't like this proposal, since it loose some feature (modify detection) and there's no way to recover without serious performance penalty, which makes no sense of bang methods usage. Alternative plans: (1) remove bang methods altogether. (2) current bang methods are bad because they work most of the cases, and fail if no change has made. thus let us make bang methods return something other than self, boolean for example, to fail always. this forces no chaining of bang methods. (3) introduce "real" multiple return values ala common lisp, and let the first returned value as the receiver and the second return value is boolean value to denote success/failure. (4) add some kind of reference counting, and if the receiver is referenced from only one place, modify the receiver in place, to gain performance. matz.