Greg Benjamin wrote:
> TkLabel.new(root)
> {
>   text "Hello, World!"
>   pack { padx 15; pady 15; side 'left' }
> }
> 
> Tk.mainloop
> ####################################################
> I get the following:
> 
> hello.rbw:7: syntax error
>   text "Hello, World!"
>         ^
> hello.rbw:7: warning: unused literal ignored
> hello.rbw:9: syntax error
> ####################################################
> The only difference between the two versions is the
> insertion of a CR/LF between ")" and "{" on line 7.
> I thought Ruby was whitespace neutral. What is wrong
> here?
> 
> I care about this because I like to line up my braces
> as shown in the second example.

Not possible, AFAIK.

Since the expression on the line with the call to TkLabel.new is 
considered complete by the parser, the block below is not attached to 
the call. I'd guess Ruby then thinks you are entering a Hash literal, 
which would explain the syntax error.

An attached block _must_ begin on the same line as the method call. You 
could perhaps add a \ to the end of the line with the method call, but 
that is quite ugly.

As for lining up braces, keep in mind that those braces are block 
delimiters and not your run of the mill compound statement delimiters 
like in C/C++, Java etc.

-- 
(\[ Kent Dahl ]/)_    _~_    _____[ http://www.pvv.org/~kentda/ ]_____/~
  ))\_student_/((  \__d L b__/     Master of Science in Technology     )
( \__\_?|?_/__/ ) _)  Industrial economics and technology management (
  \____/_?_\____/ (____engineering.discipline_=_Computer::Technology___)