From: Tim Bates Date: 2003-11-07T18:36:49+09:00 Subject: Re: ruby-dev summary 21637-21729 On Fri, Nov 07, 2003 at 06:04:47PM +0900, Laurent Sansonetti wrote: > I think it's always better to avoid operators in the end of lines (code > is therefore more readeable). > > But AFAIK && unfortunately, Ruby does not handle this kind of syntax yet. Because of Ruby's line-based syntax, Ruby guesses that if you have hit the end of the line and the line as a whole is valid, then you have finished that statement. This is essentially a limitation of the parser. There are two ways around this - require statements to end with a special character (eg a semicolon) so that if we get to the end of the line and haven't found that character yet we know the statement isn't finished, or implement look-ahead in the parser to take a look at the next line and see if it, when combined with the current line, is a valid statement as a whole. This is a lot more difficult; it involves look-ahead and creates a whole new family of ambiguities; e.g. what do you do if the next line creates a valid statement when combined with this line, and also the two lines are valid statements by themselves? So if the alternative is to require every statement to end in a semicolon (noooo!) which takes a significant chunk out of the beauty of the language, I must say that I prefer the way it is done now - and the same applies to most of Matz's decisions, which is why I love this language. Tim Bates -- tim@bates.id.au