Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operator overloading for |, at least in .vsh files, so we can pipe shit together #3191

Closed
elimisteve opened this issue Dec 22, 2019 · 5 comments
Labels
Feature/Enhancement Request This issue is made to request a feature or an enhancement to an existing one.

Comments

@elimisteve
Copy link
Member

Imagine being able to create more Bash-like .vsh scripts that do things like

xz -cd data.tar.xz | tar -xvf -

but in V:

exec('xz -cd data.tar.xz') | exec('tar -xvf -')

This may be overkill, but... kind of a fun idea!

@elimisteve elimisteve added the Feature/Enhancement Request This issue is made to request a feature or an enhancement to an existing one. label Dec 22, 2019
@elimisteve
Copy link
Member Author

...or maybe a simple function built into os would be plenty good enough:

pipe('xz -cd data.tar.xz', 'tar -xvf -')

@dumblob
Copy link
Contributor

dumblob commented Dec 26, 2019

I think the pipe operator could be "overloaded" at some point for channels (between go routines) - for more information (incl. go routine reentrancy) see #1868 . Or maybe not for channels, but rather for instruction-level parallelism using similar principles as in zero-functional.

@elimisteve
Copy link
Member Author

Good point @dumblob 👍

Closing the idea above as this is unnecessarily complexity; an os.pipe function or similar would be better.

@ofabricio
Copy link

ofabricio commented May 16, 2021

Like Built-in ORM:

customers := sql db {
    select count from Customer
}

What do you think about a built-in sh? Say:

output_value := shell {
    cat sample.txt | head -7 | tail -5
}

I suggested this in the proper topic too.

@dumblob
Copy link
Contributor

dumblob commented Jul 9, 2021

@ofabricio that has one major downside - it's not compatible with the rest of the V ecosystem. So users would require more and more functionality in such a dedicated block over time and we would end up with a reimplemented nushell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature/Enhancement Request This issue is made to request a feature or an enhancement to an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants