I remember implementing the for_form construct. At the time some people
argued that it only ever be a "user extension" so wasn't integrated
properly into the language and docs!
HELP * FOR makes only a passing reference to HELP * FOR_FORM at the
bottom. Maybe a doc maintainer could extend the reference, no more than
a paragraph and a couple of examples...
Ian.
> -----Original Message-----
> From: owner-pop-forum@cs.bham.ac.uk
[mailto:owner-pop-forum@cs.bham.ac.uk]
> On Behalf Of Stephen Leach
> Sent: 14 March 2004 23:16
> To: Luc Beaudoin
> Cc: pop-forum@cs.bham.ac.uk
> Subject: Re: for in vectors
>
> Hi Luc,
>
> >I'm wondering why no for...endfor syntax is provided for vectors.
>
> It is
> for i in_vector v do ...
> for i in_vectorclass v do ....
> But, alas, it is not documented in HELP * FOR but HELP * FOR_FORM.
Note
> that with_index does works with these forms.
>
>
> >But I was curious why it
> >was left out in the first place.
>
> For loops have been developed in a patchwork way with backwards
> compatibility preserved. This is a pity really as it has led to
> under-generalization. e.g. with_index only works with a vector-class
> iterators, using_subscriptor only works with single loop variables,
> and combination of iterators is unsupported.
>
> Of course, if you come from Java programming you will probably
> think you have died and gone to heaven (version 1.8).
>
> --
> Steve
|