JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.48k stars 5.46k forks source link

implement more special shell-like functionality in backticks #20401

Open StefanKarpinski opened 7 years ago

StefanKarpinski commented 7 years ago

Implement the following kinds of constructions in backticks using standard shell syntax:

This stuff is all currently possible, but the API for it is a bit hard to remember. This will effectively implement a portable shell-like language inside of backticks, which translates to a Julia implementation backed by libuv. It avoids most of the complexity of shells as languages since it's embedded in a full-fledged programming language (Julia).

bramtayl commented 7 years ago

What about a new method for |>?

|>(a::Cmd, b::Cmd) = pipeline(a, b)

StefanKarpinski commented 7 years ago

Been there, done that. tl;dr: |> does not generalize well to all the kinds of redirection one needs for command pipelines – giving this monster a bit of syntax only makes it hungry for more, all of which is pretty badly punny. Using standard shell syntax inside of backticks makes using syntax unproblematic since it confines the scope of its meaning to the context of backticks.