On Thu, 5 Dec 2019, Sven Schreiber wrote:
Am 05.12.2019 um 20:46 schrieb Allin Cottrell:
>
> Since "foreach" loops are advertised as working via string
> substitution, it seems they really ought to work for arrays of
> strings, and that's now in git. Trivial example follows:
First, this is of course very nice!
Secondly, the argument for why it should work is also an interesting
perspective - and: Allin I don't want to stretch this point too much, so
please don't get me wrong as being excessively demanding - but if we're
talking of string substitution in general, then wouldn't the same apply
to the keys of bundle elements?
Something like this:
bundle b = <whatever>
loop foreach i b
eval b["@i"]
endloop
Good idea -- though it would be "$i" rather than "@i" for
consistency with other cases. Note that this somewhat clunkier
version will work already (now that we handle string arrays):
<hansl>
bundle b = defbundle("x", 13, "m", I(3), "s",
"foo")
strings keys = getkeys(b)
loop foreach i keys
eval b["$i"]
endloop
</hansl>
But I agree it would be nice, and in the spirit of "foreach", if the
more streamlined version were to work too.
Allin