From: Stephen White Date: 2000-12-09T19:49:42+09:00 Subject: [ruby-talk:6962] Re: return value of mutating methods On Sat, 9 Dec 2000, Raja S. wrote: > Should the return value of mutating methods (syntactically indicated with > a suffix 'bang') be specified? Should they return value be nil or the > object being modified? Ruby lacks one programming construct which I would love to see... shell piping. I would like to be able to chain the output of one function to the input of another function. This would allow me to handle streams of data rather than needing to store data in large intermediate variables. Implementing this would be a little difficult as it would require each function to run concurrently as a thread. Your suggestion goes some way towards providing this functionality, albeit as a series of sequential steps. > In order to be able to chain mutating method calls (and the resulting > conciseness of expression) I would vote for all builtin mutating methods > to return the object so changed. A similar convention being used for all > user written mutating methods. Please add my vote to define "func!" to return the changed object. If I need to check that the change was successful, I can always opt to explicitly check. With the current method, I don't have a choice. -- steve@deaf.org