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
|