The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
C-Style For Loops Are Messed Up!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
C-Style For Loops Are Messed Up! Posted: Mar 3, 2005 3:50 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: C-Style For Loops Are Messed Up!
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

After coding in Ruby for four years now, it’s finally beginning to dawn on me how syntactically awful some traditional control structures are. The worst of which is the for loop!!

I mean look at this!

 for ( i = 0; i < strlen( poem ); i++ ) {
   printf( "%d", poem[i] );
 }

I have used this structure almost daily—and I’m sure it ultimately averages out to daily—for like a decade. Which is definitely evidence of its usefulness. But the triple expression, consisting of initiator, terminator, and incrementor, is truly hideous.

What blows my mind is that, though some of C’s legacy doesn’t carry on, this structure pervades PHP, Perl, Java and other C offspring. On the other hand, I wonder how I would feel about the syntax if more control structures used this kind of multiple expression setup.

Read: C-Style For Loops Are Messed Up!

Topic: Rails 0.10.0 loves lighttpd Previous Topic   Next Topic Topic: Rails for Strut-ters: Dealing with the view

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use