From: cjon@... (Cullen J O'neill) Date: 2000-12-04T06:40:02+09:00 Subject: [ruby-talk:6785] Re: printing/accessing arrays and hashes Yukihiro Matsumoto (matz@zetabits.com) wrote: > In message "[ruby-talk:6678] Re: printing/accessing arrays and hashes" > |Fix: Precede by an empty string. > | print "", {'a'=>1, 'b'=>2} > > Or use parentheses. If there's good way to distinguish blocks and > hashes, without confusing yacc generated parser, I'd like to know. You could require || after the opening { for blocks, that would make telling the difference easy. I know that would break too much code; maybe in version 2.0.0? > |--------------------------------------------------------------------------- > | > |Problem; a[i..j / i...j / i,cnt] returns nil instead of [] for non-existing > | segments. > | > | Creates a problem for iterators as #each isn't defined for nil. > | > |Fix: Don't know of a clean one. > | > |Comment: Either #each needs to be defined for nil [Doesn't feel right] > | > | Or a[i..j / i...j / i,cnt] should return the empty array, [], for > | out of bounds segments. [This feels right] > | > |--------------------------------------------------------------------------- > This is iteresting comment. Let's discuss. If index is out of bound, > what should [] return? nil or empty array? I'd say an empty array is closest to POLS for me. Cullen J O'Neill -- cjon@engin.umich.edu