This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-20
Channels
- # announcements (42)
- # babashka (70)
- # beginners (152)
- # chlorine-clover (19)
- # cider (14)
- # clj-kondo (23)
- # clojars (15)
- # clojure (86)
- # clojure-denmark (1)
- # clojure-dev (5)
- # clojure-europe (57)
- # clojure-france (145)
- # clojure-hungary (2)
- # clojure-italy (5)
- # clojure-nl (7)
- # clojure-spec (35)
- # clojure-sweden (2)
- # clojure-uk (58)
- # clojurebridge (1)
- # clojured (1)
- # clojurescript (50)
- # core-typed (9)
- # cursive (10)
- # data-science (11)
- # datascript (4)
- # datomic (25)
- # emacs (8)
- # fulcro (49)
- # graalvm (7)
- # graphql (6)
- # joker (1)
- # juxt (2)
- # kaocha (1)
- # off-topic (22)
- # other-lisps (1)
- # pathom (20)
- # re-frame (3)
- # reagent (11)
- # reitit (2)
- # remote-jobs (1)
- # shadow-cljs (44)
- # spacemacs (2)
- # sql (17)
- # tree-sitter (2)
- # vim (8)
- # vrac (2)
Bash. And a bunch of others: https://en.wikipedia.org/wiki/Scope_(computer_science)#Dynamic_scoping
Ouch. I don't usually write complex enough shell scripts to run into that. Thanks for the link!
You can run into that even in Clojure, with the unhygienic macros. :) That's why we end variables in macros with #
.
The behavior would be that of a function, but the name, "unhygienic macros", is different. I still think the concept is pretty much the same, but I may be wrong.
Seems like variable capture with macros works like you'd expect dynamic scoping to one way, but not both It can "shadow" a symbol within the lexical environment it's evaluated into but calling the macro won't alter the value of any bindings in outer scopes.
That's because you cannot alter a binding in an outer scope at all in Clojure, unless you explicitly call something like alter-var-root
. I don't think it has anything to do with lexical or dynamic scope. May be wrong myself though.
I use carmine
to work with Redis and I have a bunch of workers that all do the same thing - receive a message, run some task, write results to the database.
Now I need to not write the results anywhere but to send them via an open WebSocket connection to a client.
One approach that I can think of is to give each task a specific ID and make workers write the result to a different queue along with the ID - that's exactly what sente
does for WebSocket communication.
But maybe there are better approaches? Maybe something Redis- or carmine-specific?
maybe Redis streams? https://redis.io/topics/streams-intro
It doesn't seem to offer anything related to my problem in particular, does it? How would it differ in my case from just queuing a message and pub/sub?
but I don鈥檛 see how Redis is needed in this equation when you are working with Websockets
It's not as vague if you know about carmine. :) It uses worker terminology. A worker is just a dependent node deployed somewhere that consumes Redis messages and runs some code on that input. I mentioned WebSockets just for the context. The important part is that I need to be able to access the response from a worker as close as possible to the scope where the initial message from the main host has been sent.
#find-my-lib sounds like I've hidden my library and there's a prize if you find it. Find my lib: it solves the halting problem generally
There is a prize if you find/create that one. It will be a big hurdle explaining why the proofs of impossibility were wrong.