From: ES Date: 2005-03-20T07:06:54+09:00 Subject: Re: strip and its evil brother strip! In data 3/19/2005, "Nikolai Weibull" ha scritto: >* ES (Mar 19, 2005 22:40): >> > > While you might argue that modifying a String can be faster than >> > > constructing a new one based on the old one, I still think that >> > > that is not what matz had in mind when adding them. I'm not sure >> > > if this truly is how this feature was meant to be used so it's >> > > probably best to take this with a grain of salt until matz has >> > > clarified the situation. > >> > I like the current behavior and have used it in if statements more >> > than once, just to throw another log on the fire... > >> I can see that in some cases; on the other hand chaining would be >> enormously fun and useful. > >Fun? 'Conceptually better'. >> In the end, though, this just ties in with one of my firmly held >> beliefs: the success or failure of an operation should be indicated >> separately of its return value. > >How would the success or failure of strip! be returned exactly?, > nikolai Hey, I'm not a Computer Scientist :) It could be given via the return value wrapped inside a MethodCallResult [sic] structure. x = line.strip puts x if x.successful? It could be given as a special variable/method. x = line.strip puts x if successful? Or there could be an entirely new way. # test.rb # test_handling.rbh x = line.strip puts x pass if not strip.successful? E