On Wed, Jul 7, 2010 at 4:36 AM, Peter Hickman <
peterhickman386 / googlemail.com> wrote:

> On 7 July 2010 10:15, Josh Cheek <josh.cheek / gmail.com> wrote:
> > However, these examples have me so unsure of what is supposed to be what
> > that I can't construct a response illustrating this. Please double check
> > these examples.
> >
>
> 1: => a = { :fred => 42 }
>

Okay, I found the point of confusion. The confusion is that "1: => " is not
trying to create a hash table, but is rather a way of identifying line
numbers. I was opening irb in all my different rubies seeing if it would
accept
{ 1: => a = { :fred => 42 } }


> 1: => a =
> 2: => {
> 3: => :fred => 42
> 4: => }
>
> Here line 1 is incomplete so it treats line 2 as a continuation. Line 2
> says
> 'here is the start of a hash' and is also incomplete. So line 3 is seen as
> a
> continuation of line 2.
> Line 3 is complete in that it is a valid statement that can be found inside
> a hash declaration but the parser is still looking for the closing } to
> match the opening { from line 2. So although line 3 is a complete valid
> statement it is part of lines 1 and 2 which is an incomplete hash
> declaration.
>
> So line 4 is taken to be a continuation of lines 1, 2 and 3 and finally
> completes the statement that started on line 1.
>

Your explanation implies to me that the OP's desired use case is valid. If
"line 4 is taken to be a continuation of lines 1, 2 and 3" then how come
line 4 can't be ",:jim => 43"