From: Ken Bloom Date: 2008-05-04T13:40:03+09:00 Subject: Re: Ruby 1.9 wishlist On Fri, 02 May 2008 18:52:46 -0500, Marc Heiler wrote: >> You could do >> if true >> p :true end >> and that's already in the language > > But in all fairness, this is not the same as he said: > >> I'm a huge fan of one liners like: >> x if y >> ... but sometimes it just doesn't fit on one line and you need to do if >> x ... end. Needing an extra line for that end really really sucks. > > I can understand this partially. If one wants to fit in ~80 chars / > line, > and even has a few variables that may be a tad longer, or more > conditions > to check, that line would quickly get quite long, and thus you will > naturally end up doing a newline (and then an end). > > I dont think the end should be on the same line at all. In fact what he > seems to have suggested was to completely drop the end in this scenario. > This seems to be not possible, but it is simply not the same as putting > the end on the same line :) [Not sure if you agree, but I think the end > on a newline is easier to read than an end on the same line] > > FWIW I personally do not mind the newline+end at all. I dont really > think it leads to ugly code or code that "sucks". > > On the other hand though, I would like to have some language that allows > this dropping of closing clauses without writing it, but which is also > "more ruby than python" (I dont really like the def __foo__(self): stuff > ...) Python's whitespace isn't the dealbeaker for me about that langage. It's the need to explicitly mention self in the parameter list. > It also seems though that most languages out there simply have a really > horrible syntax, but maybe ruby spoiled me ... I could see a way to do it, by using the presence/absence of the "then" keyword, but that would be very unintutitive, and we'd be explaining to newbies the difference 10 times a day here on ruby-talk. Best to leave well enough alone. --Ken -- Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/