News for hackers. Stuff that matters.
Re:One Year of Nushell by ridiculous_fish on Monday August 24, 2020 @07:21PM (#24266605)
Nushell is the only shell I know of (other than fish) which uses threads. Threads are famously difficult in shells because of the fork/thread interaction.

How is Nushell able to use threads? For example how are subshells implemented?

Re:One Year of Nushell by vlmutolo on Monday August 24, 2020 @10:10PM (#24267564)
Part of it could be due to using Rust as the implementation language. Rust has good, cross-platform abstractions over things like threads and processes. The language tends to make it harder to shoot yourself in the foot.

Would definitely like to hear from the authors of Nushell on how their language choice has held up over the course of the project.

Re:One Year of Nushell by ridiculous_fish on Tuesday August 25, 2020 @02:13AM (#24268532)
A related issue is leaking fds into child processes. For example, Go locks around fork() to prevent racing with creating new fds (e.g. from pipe) [1]. Rust doesn't have any synchronization between fork and creating fds; I wonder whether/how this is addressed in nushell.

1: https://golang.org/src/syscall/exec_unix.go?s=7064:7143#L19

Re:One Year of Nushell by Matthias247 on Tuesday August 25, 2020 @01:31AM (#24268366)
My guess it doesn't use fork, apart from spawning subprocesses use fork/exec combinations. The old fork idiom isn't exposed by Rusts standard libraries and also wouldn't be "safe" to use, since the basic expecatations of the language about how many things have access to a certain variable wouldn't hold up anymore.