From: Trans Date: 2005-03-24T09:59:50+09:00 Subject: Re: RCR 296: Destructive methods return self Florian Gross wrote: > Let's keep talk about this for a moment. > > We'll finally get keyword arguments in Rite and they're already in Ruby > 1.9 as well. > > But what about keyword return values? How would those look? > > I'm not sure how this would work out, but I guess we would need to build > it on the (a, b) = [1, 2] syntax. > > Perhaps (result: a, changed: b) = obj.strip! would work. > > I think the case of (result: result, changed: changed) would be quite > common so perhaps it would be a good idea to introduce a short-cut. > Maybe (:result, :changed) = rhs. > > What do you think about this? I guess I'm getting obscure here, but this > might be an alternative to more complex solutions... I'm not sure I understand your short-cut. What variables would the results end up in? Giveing this more though... the parameters going in will be of the form, ameth( arg1: value1, arg2: value2 ) Right? So how would one define keyword return values coming out? return ( arg1: value1, arg2: value2 ) Perhaps? Then how does one capture these values, which is what you're asking. Yes? Is the return value a hash now as opposed to an array? Or is it something different entirely? Here is the example if based solely on order. r, c = obj.strip! But this won't work if an actual hash is being returned. And as things stand, if an actual hash is being returned something like this has to be done: h = obj.strip! r, c = h[:result], h[:changed] So how can these two become integrated and consistent? T.