Re: recursive iterators

Ray Dillinger <>
21 Mar 2002 22:02:50 -0500

          From comp.compilers

Related articles
recursive iterators (2002-03-09)
Re: recursive iterators (Randall Hyde) (2002-03-19)
Re: recursive iterators (Ray Dillinger) (2002-03-21)
Re: recursive iterators (2002-03-31)
Re: recursive iterators (Randall Hyde) (2002-04-06)
| List of all articles for this month |

From: Ray Dillinger <>
Newsgroups: comp.compilers
Date: 21 Mar 2002 22:02:50 -0500
Organization: Compilers Central
References: 02-03-032
Keywords: design
Posted-Date: 21 Mar 2002 22:02:50 EST

Alex Colvin wrote:
> Are there any languages, especially C derivatives, with extensible control
> structures. C++ seems to have gone overboard with data-structure
> extensions, but (aside from exceptions, to which I take,) left control
> alone.
> To be (lightly) more specific, I have a program where I walk tree
> structures recursively, generating elements of a sequence. The program
> does several of these walks at once, doing different things with the
> elements.
> Any thoughts? Is this straightforward in some popular language? Am I just
> thinking incorrectly?

Well, scheme makes the job you describe extremely straightforward.
You can pass procedures, closures, and continuations around, store
them in data structures, build executable code from data on the fly,
whatever. Since scheme allows both "up" and "down" continuations
(ie, the stack is saved with the continuation so you can return
from procedures more or less often than you call them) and allows
continuations to be stored as values in variables, you can
literally implement whatever control structure you can imagine in
a straightforward way. It's *NOTHING* like C, though.

[It's pretty easy in perl, too. -John]

Post a followup to this message

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