From: Robert Klemme Date: 2010-07-11T21:05:03+09:00 Subject: Re: what about allowing to specify, which end belongs to which start? On 11.07.2010 13:32, Caleb Clausen wrote: > On 7/11/10, Robert Klemme wrote: >> I don't want to advocate this but concatenating "end" directly with the >> opening keyword is probably easy to do because it will create a whole >> bunch of new tokens , so there would be >> >> endclass >> endmodule >> enddef >> endbegin >> endif >> endunless >> endwhile >> enduntil >> endfor >> enddo >> endcase > > Eh, I don't like it either. > > >>> However, after giving it a little >>> thought, it seems to me that a form of this feature could be >>> reintroduced with not an excessive amount of trouble. If the keyword >>> being terminated is immediately followed by a newline or semicolon, it >>> is treated as a Jan wants. Otherwise, it's treated as a 'modifier' >>> flow control (if it's an if or unless or etc). >> >> IMHO this is not feasible: "if" is almost always followed by >> a line break. And think about > > Yes, but 'if' itself almost never is. Unfortunately the word "almost" makes this unusable for creating a parser. How do you want the parser to decide if the case at hand is one of the rare cases? Even if it would be feasible this sounds like an awful hack and I'd rather not make parsing more complicated (and thus slower) as it is today. > So when the parser sees 'end' > followed by 'if' followed by newline, it can treat that specially. > >> begin >> puts "aaa" >> end if >> x> 100 >> >> This is perfectly legal with the current syntax but it looks like "end >> if" would be a terminator while in reality it is a statement modifier. > > I did consider this. Who ever writes this way, instead of putting the > 'if' and condition on the same line? In cases like this, I think it > would be acceptable to break broken style. Let's hear what others say. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/