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

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Fri, 25 Jun 2010 23:41:14 +0200

          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: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Fri, 25 Jun 2010 23:41:14 +0200
Organization: Compilers Central
References: 10-06-037 10-06-044 10-06-050 10-06-054 10-06-061 10-06-064 10-06-071
Keywords: design, optimize
Posted-Date: 26 Jun 2010 10:53:39 EDT

Paul Biggar schrieb:


>> 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


The above (Pascal/OPL) For loop allows for aggressive optimization,
suitable for fast simple loops. Iterators are bit slower by nature, but
such overhead can be neglectable depending on the body of the loop.


DoDi



Post a followup to this message

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