[Swift-devel] Call function.

Yadu Nand yadudoc1729 at gmail.com
Fri Aug 12 08:34:11 CDT 2011


> There's only one function namespace at the moment.
Yes, that answers the question.

> You can do a map now using foreach, without writing a separate procedure. that was one of the original "interesting things" that swift did beyond VDL.
> hategan posted recently about using foreach to iterate "sequentially" over data (meaning a value in the output array can depend on everything to the left of it) which looks like it could do a lot of fold-like stuff too. (in a thread about getting rid of iterate).
> (That needed the ability to access "the previous" element - when you're numbering your output array with an integer, thats easy: here-1. But when you're using 'auto', then that doesn't work (and the meaning of "the predecessor" is not immediately apparent in the case of 'auto' - there are a few different things it could mean))
So we don't need functional iterators in swift ? Why was this on the
gsoc-ideas list ?
I was under the impression that functional iterators will be useful in
some way :(

> What you can't do at the moment is use some function identity (be it a string or be it some richer function reference) - and given that, I find your comment:
>
>>  If that is the case, the reason for having
>> functions passed to other functions almost goes away. I can't
>> imagine any scenario in which we might need that.
>
>
> a bit perplexing because I thought that throwing functions around as values was exactly what you wanted to do?

If all the functions existed in the same namespace (or if there is no
concept of namespace),
we don't need to pass functions to other functions, do we ? What I
understand is that, we
pass function-a to function-b so that function-a becomes available
under function-b.


-- 
Thanks and Regards,
Yadu Nand B



More information about the Swift-devel mailing list