From: Michal Suchanek Date: 2008-01-17T19:58:59+09:00 Subject: Re: ruby annoyances ... mine is line continuation, what's yours? On 16/01/2008, Karl von Laudermann wrote: > On Jan 16, 2:41 pm, "scoot...@hotmail.com" > wrote: > > > > Consider: > > > > puts 'cat :: dog :: elephant :: mouse :: gorilla'. > > split('::'). > > map{|str| str.strip() }. > > select{|str| str['o']}. > > join("\n") > > > > If you ask "why is this an annoyance" ... it's because you have > > to put the period at the *end* of each item, even though some > > prefer to put it at the beginning. > > When splitting a long line across an operator, I've always preferred > to put the operator at the end, because it makes it obvious that the > line isn't finished. Not just for the Ruby interpreter, but for the > user as well. Even in Java, I prefer to write: > > int val = Foo.someLongThing() + > Bar.otherLongThing(); It depends on the operator. `+' is quite easy to see but a `.' is not. Note that in writing it is customary to put the operator both on the line end and on the beginning of the next line so that it's clear wherever you start reading. Indentation usually can serve that purpose in electronic form so the operator at the start is less important for understanding the program. However, you would need an editor that automatically and correctly adjusts indentation to detect the missing operator. Thanks Michal