4 ms·
I had similar thoughts some time ago but came to a very different conclusion: anything the shell can do a programming language could do just as well, given the
by StefanKarpinski 9y ago
I had similar thoughts some time ago but came to a very different conclusion: anything the shell can do a programming language could do just as well, given the right interface. The fact that languages don't make it easy to spawn subprocesses safely doesn't mean that they couldn't do so. The right solution is making it both convenient and safe to do shell-like things from within a real programming language. So I made sure that Julia does this right:
https://julialang.org/blog/2012/03/shelling-out-sucks https://julialang.org/blog/2012/03/shelling-out-sucks
https://julialang.org/blog/2013/04/put-this-in-your-pipe https://julialang.org/blog/2013/04/put-this-in-your-pipe
- elcritch 9y agoNever realized you could do that. Hey hank you, that’s handy! One question though, is it possible to intersperse pure Julia functions but still have them piped, e.g. write custom “shell” commends?
- StefanKarpinski 9y agoIt's not currently, but I'm planning on adding that feature in a future version along with making shell metacharacters like `>` and `|` act much like they do shells when they appear inside of Julia command literals. When we do that, we'll be able to support splicing Julia functions and/or tasks into pipelines.
- elcritch 9y agoThat'd be fun! I'll keep an eye out for it. Yesterday I was playing around with `eshell` in Emacs and the ability to redirect command output into buffers and modify them with code turns out surprisingly handy.
- bjoli 9y agoScsh also does this right. It makes me sad that no one actually successfully ported it to other schemes.
- codemac 9y agoThere was a port of scsh to guile that was more of a library - it worked really well. I doubt it's up to snuff on guile 2.0+ though.