Prev: Thread error "undefined method `keys' for nil:NilClass"
Next: Getting version from PE executables
From: Marnen Laibow-Koser on 9 Nov 2009 08:51 Seebs wrote: > On 2009-11-09, Marnen Laibow-Koser <marnen(a)marnen.org> wrote: >> Where's the benefit? What is some actual Ruby code that would be >> improved by these constructs? > > blahblahblah.each do |args| > lots of stuff lots of stuff > if condition > count += 1 > end > end > > I'd rather see "++count". It's easier for me to read. Would you? Or would you rather see count = blahblahblah.count do |args| lots_of_stuff condition end ? > > -s Best, -- Marnen Laibow-Koser http://www.marnen.org marnen(a)marnen.org -- Posted via http://www.ruby-forum.com/.
From: Seebs on 9 Nov 2009 09:28 On 2009-11-09, Marnen Laibow-Koser <marnen(a)marnen.org> wrote: > Would you? Or would you rather see > count = blahblahblah.count do |args| > lots_of_stuff > condition > end Huh! That is prettier. Didn't know it existed. But in general, basically, any place where we have a += 1, I'd prefer ++. And I am pretty sure that +=1 is occasionally useful. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Rick DeNatale on 9 Nov 2009 09:55 On Mon, Nov 9, 2009 at 8:40 AM, Seebs <usenet-nospam(a)seebs.net> wrote: > On 2009-11-09, Marnen Laibow-Koser <marnen(a)marnen.org> wrote: >> Where's the benefit? What is some actual Ruby code that would be >> improved by these constructs? > > blahblahblah.each do |args| > lots of stuff lots of stuff > if condition > count += 1 > end > end > > I'd rather see "++count". It's easier for me to read. Hey, I might 'rather' have C allow if statement modifiers. And I might 'rather' have French do away with all those pesky gender agreements and thinking of towers as feminine and a lap around a track as masculine. But they don't, and I find I can live with that, and I certainly have been much happier with Ruby even without a++ or ++a than I ever was in C/C++, and I am, or at least was, competent enough in C to do things like writing compilers in it, and reading and understanding the Ruby source code etc. This whole thread is reminding me of Mark Twain's complaint about the stupidity of the French, because he "never could get them to understand their own language!" -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale
From: Marnen Laibow-Koser on 9 Nov 2009 10:03 Rick Denatale wrote: > On Mon, Nov 9, 2009 at 8:40 AM, Seebs <usenet-nospam(a)seebs.net> wrote: >> >> I'd rather see "++count". �It's easier for me to read. > > Hey, I might 'rather' have C allow if statement modifiers. > > And I might 'rather' have French do away with all those pesky gender > agreements and thinking of towers as feminine and a lap around a track > as masculine. > > But they don't, and I find I can live with that, Ce n'est pas la même situation. Nous anglophones ne pouvons pas changer la langue française tout d'un coup. Mais nous pouvons changer Ruby si nous en avons besoin. > and I certainly have > been much happier with Ruby even without a++ or ++a than I ever was in > C/C++, Mais oui! Best, -- Marnen Laibow-Koser http://www.marnen.org marnen(a)marnen.org -- Posted via http://www.ruby-forum.com/.
From: Seebs on 9 Nov 2009 10:30
On 2009-11-09, Rick DeNatale <rick.denatale(a)gmail.com> wrote: > But they don't, and I find I can live with that, and I certainly have > been much happier with Ruby even without a++ or ++a than I ever was in > C/C++, and I am, or at least was, competent enough in C to do things > like writing compilers in it, and reading and understanding the Ruby > source code etc. I'd rather use Ruby without those features than C++ with them. (Not quite so sure about C, but certainly there's plenty of things for which I'd rather use Ruby than C.) But on the other hand, I really do like the syntactic sugar. My favorite syntactic sugar ever was Icon's swap operator. Sure, you don't need it often, but it sure is nice to be able to express it so clearly. -s -- Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated! |