From: Harold Hausman Date: 2006-08-06T14:20:46+09:00 Subject: Re: Whitespace matters in instance_eval? I'm confused On 8/6/06, Rick DeNatale wrote: > On 8/6/06, Harold Hausman wrote: > > > irb(main):004:0> foo.instance_eval "3.times\n{ puts 'boom' \n}" > > SyntaxError: (eval):3:in `irb_binding': compile error > > (eval):2: syntax error > > { puts 'boom' > > ^ > > (eval):3: syntax error > > from (irb):4 > > > > #is there a rule that says that the opening curly brace has to be on > > the same line? > > I think that it pretty much falls out of the way Ruby handles lines in > source. As the pickaxe put's it Ruby is 'line-oriented' > > 1) An expression or statement which looks like complete by the end of > the line IS considered complete > > 2) Blocks are optional in method calls, so > 3.times > looks like (and is a complete expression, and a complete statement) > > 3) a bare block is not a valid statement > > It's got nothing to do with instance_eval > ... > -- > Rick DeNatale > Makes good sense, thank you kindly. -Harold