Lutz wrote:isn't 'Dragonfly' (as a context) what you want to have returned from the caller of '(for-query-with-db db query)' ? Isn't the function which calls '(for-query-with-db db query)' in the 'Dragonfly' context?
Yes, it is. Do you not see something weird about caller returning Route.Static, and then Dragonfly in the same function?
In your edit of the post I am still not seeing the difference and I am not sure you understand how 'caller' works ;-?. Did you read the reference for 'caller' in the link I posted? You need a caller for the function called. So there are two functions involved: the caller and the callee who wants to know about the caller's symbol and context.
I read it, and in my post above I demonstrated my understanding of how caller works by stating:
itistoday wrote:Apparently I have to call (foo) from within a function for caller to be useful, and not even any function but specifically a *user-defined* function. To me this makes caller almost completely useless; I can't define for-query-with-db or any other interesting functions with it. :-(
Lutz wrote:Also, please post a complete example, boiled down to an absolutely minimum. I am not going through other's code trying to find out what 'define-smacro' does etc..
Unfortunately I don't have time right now to do that (I have a *lot* of stuff I need to finish right now). I think I've done a pretty good job of explaining exactly what the code does and how it's called, and I've certainly demonstrated that
caller is broken.
Further, it is not required that I post any condensed version of code (you could do that yourself, I've shown caller is buggy, and I've explained how I use it), because when I originally explained the desire for a function like
caller, I described in detail exactly how it should behave, yet this is not what it does. To reiterate:
itistoday wrote:No, you seem to have completely misread what I've said here, and in the other thread. context returns the context that the function is in. I need the context from which the function was called.
If you can't add that, fine. I'll either have to scrap
for-query-with-db (and a bunch of other functions that could benefit from a useful
caller function) or rewrite it in some manner.