From: Jason Creighton Date: 2003-08-02T13:56:00+09:00 Subject: Re: Ruby could be wildly more popular if it had ... On 29 Jul 2003 10:22:38 -0700 quixoticsycophant@yahoo.com (Jeff Mitchell) wrote: > Then screw popularity. We don't need whimsy programmers who are > attracted to the simulated familiarity which brackets give. Such > shallow programmers we can do without, thank you. > > Then you shall continue basking in the lonely sunshine of relative > obscurity, secure in your knowledge of what programmers should be > like. Good luck with all of that. Okay, I will. > Exhibit A. > ---------- > Ruby as it exists presently. > "Oh great another language trying to be different." > > "Pascal sucks. I hate the 'end' keyword." > > "My editor isn't set up to handle this language. I don't understand > why they can't just use brackets." > > "A garbled mess, looks like. It's confusing without brackets to guide > my eye." "If you find this hard to read, maybe you should use a higher indentation level" > Exhibit B. > ---------- > "Wow cool language. I see what's going on immediately." > > "I like how it's familiar. My eye is trained to follow brackets, so I > can size up this code with one glance." > > "Hey this looks just like Java! I know Java! I can't wait to start > using ruby as my no-separate-compile-step language!" > > "Dude this is gonna kick perl's ass." "Wow, this language's syntax is incredibly brain-damaged!" Seriously, the brackets _do_ make it a _little_ easier to read. But, what if you had formatted it like so: class IO expect(pat,timeout=9999999) buf = '' case pat when String e_pat = Regexp.new(Regexp.quote(pat)) when Regexp e_pat = pat end while true if IO.select([self],nil,nil,timeout).nil? result = nil break end c = getc.chr buf << c if $expect_verbose STDOUT.print c STDOUT.flush end if mat=e_pat.match(buf) result = [buf,*mat.to_a[1..-1]] break end end if iterator? yield result else return result end nil end end Or what if you used a higher level of indentation? class IO def expect(pat,timeout=9999999) buf = '' case pat when String e_pat = Regexp.new(Regexp.quote(pat)) when Regexp e_pat = pat end while true if IO.select([self],nil,nil,timeout).nil? then result = nil break end c = getc.chr buf << c if $expect_verbose STDOUT.print c STDOUT.flush end if mat=e_pat.match(buf) then result = [buf,*mat.to_a[1..-1]] break end end if iterator? then yield result else return result end nil end end Both options, are, I think, better than adding "brackets". And both can be done without hacking the interpreter. > I am being more serious than it may or may not appear. I think ruby > missed out on a big chance here. It is absurd, but it's true. I disagree. (The part about it being true, not the part about it being absurd. :-) ) Jason Creighton