-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
[ Feature request ] Connecting code blocks through pipes. #27
Comments
@AlvaroBernalG for the first snippet why couldn't you just have both of those in the same block of code? |
@mfix22 The purpose of the example was to show how two code blocks could communicate. |
hmm can you help me understand the use case? I don't want to make it overly complex. |
@egoist yea, i'm curious to hear too. If we decide to do it, it looks like that we should add some global variables like |
@egoist, @olstenlarck
There are some task that are easier to do in certain languages. Take for example downloading a config file from a website: Node.js: const http = require(‘http”)
http.get({
hostname: 'mywebsite/config.json',
port: 80,
path: '/',
agent: false // create a new agent just for this one request
}, (res) => {
// Do stuff with response
}); Now compare that solution with the simplicity of curl https://mywebsite.com/config.json > config.json
BEGIN => // take a css file. THEN => // take the css file and strip out the comments. THEN => // take the result of stripping out comments and minimize it. THEN => // Take the result of stripping out comments and minimised and save it into my S3 bucket . Maybe in the future you just don't want to minimise the css, in that case the only thing that you would have to do is to remove the code block that handles the CSS minimising and everything would work. |
My opinion is that this is out of scope of what I do think your idea is actually very good, but it's going to add layers of complexity which To give some background, I have already developed a similar system to what you have described ( connecting code snippets through STDIN / STDOUT or as HTTP middlewares ). Mostly we used HTTP, but it's all essentially just generic streaming interfaces. If you are interested in how we did this, here are some examples including chaining services of multiple languages which may inspire you: https://github.com/Stackvana/microcule/tree/master/examples I'm glad to offer any input I can. I've been working with this kind of development pattern for a few years and am eager to see more developers thinking about the problem space. |
Hello good people of maid,
It would be useful if code blocks could communicate somehow.
Stdin - stdout
In the following pattern the code blocks are connected through the stdin-stdout:
Next
Another way of allowing communication between code blocks is by injecting a method inside each code block in a similar way of how
express.js
does it with their middlwares.This pattern can also be used to control the execution flow:
The text was updated successfully, but these errors were encountered: