Fork me on GitHub
#off-topic
<
2020-02-20
>
mloughlin11:02:30

Do any "modern" languages use dynamic scoping as their primary scoping method?

mloughlin12:02:39

Ouch. I don't usually write complex enough shell scripts to run into that. Thanks for the link!

p-himik12:02:06

You can run into that even in Clojure, with the unhygienic macros. :) That's why we end variables in macros with #.

mloughlin12:02:58

Do macros count as dynamic scoping if they run at compile time? 馃く

mloughlin12:02:17

time to check Let Over Lambda again...

p-himik12:02:42

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.

mloughlin13:02:11

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.

p-himik14:02:36

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.

mloughlin15:02:09

Dynamic scoping is so un-intuitive to me!

p-himik15:02:07

And most of the languages don't support it for a good reason. :)

p-himik11:02:49

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?

p-himik12:02:00

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?

kszabo12:02:13

well the problem description was kind of vague

kszabo12:02:29

IDK what the workers are

kszabo12:02:56

but I don鈥檛 see how Redis is needed in this equation when you are working with Websockets

p-himik12:02:34

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.

dominicm21:02:38

#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

p-himik22:02:44

OK, seriously though - where did you hide this one?

andy.fingerhut22:02:06

There is a prize if you find/create that one. It will be a big hurdle explaining why the proofs of impossibility were wrong.