On Mon, Feb 20, 2012 at 10:26 PM, Eric Christopherson <
echristopherson / gmail.com> wrote:

> On Sun, Feb 19, 2012 at 4:08 PM, Josh Cheek <josh.cheek / gmail.com> wrote:
> > On Sun, Feb 19, 2012 at 3:49 PM, Hal Fulton <rubyhacker / gmail.com>
> wrote:
> >>
> >> I admit I still use 1.8.x more often than 1.9.x -- and I keep running
> >> across
> >> little things that puzzle or annoy me.
> >>
> >> Why is it that this statement:
> >>
> >>   value
> >> =
> >>     if
> >> block_given?
> >>       yield
> >> str
> >>
> >> else
> >>
> >> str.send(converter)
> >>
> >> end
> >>
> >> cannot be rewritten as:
> >>
> >>   value = block_given? ? yield str : str.send(converter)
> >>
> >>
> >> Just curious...
> >>
> >> Hal
> >>
> >
> > It seems to be getting parsed like this
> > value = block_given? ? yield(str : str.send(converter))
>
> What syntactic sense does (str : str.send(converter)) make in Ruby? My
> first thought was that it would think str is a symbol key, but that
> doesn't seem to be a case (you can't write a hash as {foo : 'foo'}).
>
>
Well, you can write it as {foo: 'foo'}, so I suppose it could look like you
meant to write a hash but made a mistake. More likely, this is probably
just an edge case in the parser's abilities.