On Jul 20, 10:18 am, Trans <transf... / gmail.com> wrote:
> On Jul 20, 9:36 am, Stefan Rusterholz <apei... / gmx.net> wrote:
>
> > Trans wrote:
> > > Sure. I realize. I'm only pointing out that this -> operator is
> > > equivalent to a rescue NoMethodError,
>
> > So how can I explain to you that it *isn't*?
>
> Just tell me, how isn't it? The end result seems exactly the same me.
> How does:
>
>   foo = (bar.baz default bar).quuz default quux
>
> differ in result from:
>
>   foo = (bar->baz || bar)->quuz || quux

I went back and reread the first post. You actually want it to only be
effective on nil. Okay, I see the basic difference. In my example if
bar.baz returned nil then the default quux would be the result. In
yours it would be bar. However, I'm not sure that's better. I can just
do

   foo = (bar.baz || bar).quuz default quux

to get your behavior. But your technique can not do what mine can.

T.