From: Logan Capaldo Date: 2007-10-02T05:20:04+09:00 Subject: Re: Can you please help to make decision? On 10/1/07, Chad Perrin wrote: > On Mon, Oct 01, 2007 at 03:25:37AM +0900, 7stud -- wrote: > > Here's a simple test for the op. Which of the following do you think is > > easier to understand? Can you guess what each program does? > > > > language1: > > -------- > > > > colors = ["red", "blue", "green"] > > > > colors.each {|color| puts color} > > > > > > language2: > > --------- > > colors = ["red", "green", "blue"] > > > > for color in colors: > > print color > > In the case of someone who has never programmed before, I rather think > "colors.each {|color| puts color}" might be less confusing than "for > color in colors:\n print color". I have never in my life seen anything > in plain English that even began to look like "for color in colors", and > the meaning of that clause is non-obvious. Meanwhile, "colors.each" at > least looks like it's saying something about each of something, with the > "each" attached obviously to the "colors", suggesting that it's saying > "for each element of the colors array". > > The only way the Python one looks anything like "more intuitive" to > someone who has never encountered Ruby or Python before, as far as I can > tell, is if that person is familiar with C. > You bring up an excellent point. Where the hell did "for" come from anyway? Only thing I can think of is "for all x in X" kinds of statements from math, but thinking about it now, "for" seems like such a weird word. I just looked it up, man is this word overloaded: http://dictionary.reference.com/browse/for If I ever create a language, the word "for" shall not appear as an interation construct in it. > -- > CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] > They always say that when life gives you lemons you should make lemonade. > I always wonder -- isn't the lemonade going to suck if life doesn't give > you any sugar? > >