Search code examples
clojurefuturemeta

Retrieving unassigned objects


I was looking through http.async library and found a piece at this line

Function execute-request returns a map with some promises. The interesting part is where it returns the map with (with-meta ...) parameters. It assigns the metadata :cancel which is a function that invokes .cancel on a response object (.cancel resp-future true).

My question is, what happens to the resp-future symbol? Is there any way I can access it, or is it just "lost" and the only way I can interact with it is through (meta ...) ?

Thanks!


Solution

  • Actually you shouldn't need the resp-future which is as future response as you can see at the source Java library

    What the function returns is a resp map as per documenation says with some extra meta information, hence the final with-meta, have a look at the docs and examples.

    For completion sake the answer is no, you cannot access the resp-future identity, please let us know what are you trying to do to help further.

    Regardless of that I encourage you to make sure to understand how let works as it's a fundamental Clojure construct.