Re: Unnatural iteration [was: Testing strategy for compiler]

Paul Biggar <paul.biggar@gmail.com>
Wed, 23 Jun 2010 17:12:11 +0100

          From comp.compilers

Related articles
Testing strategy for compiler kuangpma@gmail.com (kuangpma) (2010-06-16)
Re: Testing strategy for compiler ott@mirix.org (Matthias-Christian Ott) (2010-06-18)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-18)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-19)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-21)
Re: Testing strategy for compiler news@cuboid.co.uk (Andy Walker) (2010-06-22)
Re: Unnatural iteration [was: Testing strategy for compiler] paul.biggar@gmail.com (Paul Biggar) (2010-06-23)
Re: Unnatural iteration [was: Testing strategy for compiler] DrDiettrich1@aol.com (Hans-Peter Diettrich) (2010-06-25)
| List of all articles for this month |

From: Paul Biggar <paul.biggar@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 23 Jun 2010 17:12:11 +0100
Organization: Compilers Central
References: 10-06-037 10-06-044 10-06-050 10-06-054 10-06-061 10-06-064
Keywords: design
Posted-Date: 25 Jun 2010 16:19:40 EDT

On Tue, Jun 22, 2010 at 12:18 PM, Andy Walker <news@cuboid.co.uk> wrote:
> B You have some
> items to process in order, so you write
>
> B B B B FOR n := 1 TO nitems DO processitem (n) DONE
>
> What could be more natural?


I find this quite unnatural and inelegant, compared to some newer languages:


Python: for i in items: processitem(i)
Ruby: items.each { |i| processitem i }
Haskell: map processitem items


I don't see why there is a need for manually iterating through
anything. In the sample above, I had to quickly check whether there
was an off-by-one error.
--
Paul Biggar
paul.biggar@gmail.com
[We're getting close to the where-do-the-semicolons-go point of no
return. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.