On Jul 28, 2006, at 12:45, Daniel Schierbeck wrote:

> I have no problem doing this:
>
>   if foo :bar then
>     ...
>   end

Which is odd, 'cause I get this error:

c = [something]
if c :foo then
   puts "blah"
end
SyntaxError: compile error
(irb):3: parse error, unexpected kTHEN, expecting kEND
         from (irb):5
         from :0


What would you expect an expression of the form 'c :symbol' to mean  
in the first place?  The only parallel I can think of is some sort of  
implicit concatenation like happens with strings ("foo" "bar" =>  
"foobar"), but I don't think that's a generalisable operation.

> Yet when I do this:
>
>   case "foo"
>     when bar :baz then "bur"
>   end
>
> I get the following syntax error:
>
>   SyntaxError: compile error
>   (irb):30: parse error, unexpected tSYMBEG, expecting kDO or '{'  
> or '('
>     when bar :baz then "bur"
>               ^
>
> Is this intentional? Having the expression span multiple lines  
> doesn't solve it.

At this point it strikes me as intentional in the sense that it's not  
a valid expression to begin with.  Sorry if that's not the most  
helpful answer; maybe further explanations might clear things up for me.

matthew smillie.