News for hackers. Stuff that matters.
Re:Dynamic Scoping in C++ by brandmeyer on Monday September 21, 2020 @02:03PM (#24546478)
IMO, the most comprehensive solution to this mechanism is provided in Racket scheme's parameterize system. Racket's parameters are about as safe as global variables can get. https://docs.racket-lang.org/guide/parameterize.html

What value does a forked thread get? The value at the dynamic scope of the parent at the point of thread creation.

What happens if a delimited continuation is invoked by a different thread compared to the one that created the continuation? If a parameterize call was made within the continuation's delimited extent, then it moves with the continuation. If not, it'll be in the executing thread. In either case the answer is consistent: The value within the dynamic extent of the continuation is used.

What happens to other threads if one overrides a parameter within its own dynamic scope? Nothing, threads don't have a dynamic scope relationship between them after thread creation.

Re:Dynamic Scoping in C++ by soegaard on Tuesday September 22, 2020 @08:08AM (#24553521)
I agree that Racket parameters work very well.

FWIW the Racket parameters are inspired by:

"Processes vs. User-Level Threads in SCSH" by Martin Gasbichler and Michael Sperber

https://www.researchgate.net/publication/2546137_Processes_v...