From: "Martin J. Dürst" Date: 2010-09-09T20:33:58+09:00 Subject: [ruby-core:32222] Re: Ruby 2.0 Wiki/Wish-list? On 2010/09/09 3:50, Kurt Stephens wrote: > --------------------------------------------------- > > I'd like to implement: > > x // y # and x //= y > > => > > (tmp = x) != nil ? tmp : y One case that I remember having met frequently, and that seems to be related to this, is: In a method chain, apply methods successively, except if the receiver is nil, in which case, just keep it as nil. As an example, I'd like to write something like: ((tmp1=a).nil? ? nil : tmp1.method1(args)) as something like: a.unless_nil.method1(args) > And > > x&&.y&&.z # and x//.y//.z > > => > > (tmp = x) && (tmp = tmp.y) && tmp.z Shouldn't that be (tmp = x) && tmp.y && tmp.z ? That would make more sense to me. Also, is there a way to express this as a binary operator? And what's the semantics of x//.y//.z ? Regards, Martin. -- #-# Martin J. D��rst, Professor, Aoyama Gakuin University #-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp