From: Matt Maycock Date: 2005-03-24T10:28:24+09:00 Subject: Re: RCR 296: Destructive methods return self Note that I was just showing something for not using that temporary variable... not to show how to make it consistent - I have had very little decent sleep, and this previous seemed like an important email to write. apologies. ~Matt On Wed, 23 Mar 2005 20:26:25 -0500, Matt Maycock wrote: > > h = obj.strip! > > r, c = h[:result], h[:changed] > > > > So how can these two become integrated and consistent? > > > > T. > > strip_result, strip_changed = *obj.strip!.values_at(:result, :changed) > > or, if you do the following (untested, but assumed true due to my > infalliability? we can just assume I'm infalliable for the next few > lines - then back to normal falliability): > > class Hash > def [] (*args) > return self.fetch(args[0], self.default) if args.length == 1 > return self.values_at(*args) > end > end > > then we can have > strip_result, strip_changed = *obj.strip!()[:result, :changed] > > then, you could have things like > if obj.strip!()[:changed] then... > end > > or > meow = obj.strip!()[:result] > > however, I can see some complaints aesthetics wise about the () in > there. What we need is keyboards with more than just <{[()]}> for > bookends... > > maybe have it hash indexing be syntactically wonderful instead of methody? > > then, we could have > hash[|key|] > and making this not methody means we could do something like > meow = obj.strip![|:result|] > > note that just suggestions, and pulling from that other thread... I'm > okay with typing a bit more. > > ~Matt > > -- > There's no word in the English language for what you do to a dead > thing to make it stop chasing you. > -- There's no word in the English language for what you do to a dead thing to make it stop chasing you.