Semantics of first-class functions

hi everyone!

I’d like to make a proposal on the semantics of first-class functions. This is a topic that I’m very interested in, because I think they are very important to keep a clean architecture in larger libraries. Pearu implemented the FunctionType earlier this year, which provides a great foundation for future work.
However, there are a lot of opens question about how first-class functions should behave, especially for containers.
Before any implementation work is done, I thought it would be useful to document the intended semantics of these types. This can help guide the implementation, and also avoid discussions where implementation and semantics gets mixed, or even worse, where semantics are implicitly defined by implementation constraints.

The first draft of the document is accesible as a gist here https://gist.github.com/luk-f-a/a183719b2b0c6abca4ec7efc75310b43

All comments welcome, the more the better!

Cheers,
Luk