From: Robert Dober Date: 2008-10-05T07:08:29+09:00 Subject: Re: Is Assignment in a Conditional an Idiom? On Sat, Oct 4, 2008 at 5:19 PM, Gregory Brown wrote: > > @a["b"].split rescue [] > > What you're trying to say is "If @a['b'] is nil, default to []" No OP had non strings and wanted them unchanged, so that was just short for @a["b"] = @a["b"].split rescue @a["b"] > > But when you have > > @a = nil, > > this does not catch it. That however is a valid point. I indeed made a mistake here, I consider @a['b'].split rescue nil bad code too but did not recognize it. This makes it difficult to argue for x.split rescue [] So I have eventually to give in :) in most cases. > Your code is far from educational, it is misleading, and the rules you > talk about are really behaviors, and if you want to assume that you > could treat all behaviors the same way, go for it, and have fun > debugging. No debugging, testing, and no rules, I mean I screwed my rules up :). But you are right my code was not educational. Robert -- C'est véritablement utile puisque c'est joli. Antoine de Saint Exupéry