On Wed, Nov 19, 2008 at 12:57, Paul Brannan <pbrannan / atdesk.com> wrote:
> The last case is no longer hanging with the latest trunk; I don't know
> if something was fixed or I got lucky or whether I had a bad build.
>
> The behavior is still clearly different between 1.8 and 1.9.  Is this
> expected?

The main case I would have to favor 1.9 is when splatting into arrays:

  [*some_collection_or_single_object_or_nil]

This allows turning any object into an array that can then be iterated
on. No flattening needed:

  a = [1,2,3] # more than one object
  [*a] #=> [1,2,3]
  a = "hello" # Just an object
  [*a] #=> ["hello"]
  a = nil # nil representing nothing in this context
  [*a] #=> []

Combine this with the more flexible splat patterns and you can
construct collections to easily iterate over that can take all kinds
of inputs. This is sort of like Ruby's doorway into array programming.

Brian.

> On Wed, Nov 12, 2008 at 10:10:12PM +0900, Paul Brannan wrote:
>> I'm seeing differing behavior on 1.8 and 1.9.  Is this intentional?
>>
>> cout@bean:~$ ruby -e 'def foo; return *nil; end; p foo'
>> nil
>> cout@bean:~$ ruby1.9 -e 'def foo; return *nil; end; p foo'
>> []
>> cout@bean:~$ ruby -e 'p *nil'
>> nil
>> cout@bean:~$ ruby1.9 -e 'p *nil'
>> <sometimes hangs, sometimes returns immediately>
>>
>> Paul
>>
>>
>
>