5
54
Fork
You've already forked blue
4

Implement pipline operators #280

Closed
opened 2026年05月08日 10:13:25 +02:00 by pastor · 1 comment

After some discussions we've noticed that we can introduce pipeline operators (for lack of abetter term). The idea is that a chain of commands, as it currently stand, lacks the expressiveness of boolean operations.

There are 2 approaches, either we allow sexp style syntax or a threading style. For example, calculators avoid that using Reverse Polish Notation. We don't need exactly that, we can do a thread macro style of syntax.

Some examples:

  • Sexp: blue --pipeline=(and (or build repl) dist)

  • Threading: blue buid -> repl -- dist

  • Sexp: blue --pipeline=(or (and configure build) (and help repl))

  • Threading: blue configure -- build -> help -- repl

  • Sexp: blue --pipeline=(or (and configure build) (and clean build) report-bug repl)

  • Threading: blue configure -- build -> clean -- build -> report-bug -> repl

So with this notation, the status value is always passed to the next operator for checking what to do.

The trick to reason about how to write the expressions is to think in CPS style. You reason about it from inside-out. So you think about the continuation of the operation.

Unless I'm missing something, this should cover all cases.

After some discussions we've noticed that we can introduce pipeline operators (for lack of abetter term). The idea is that a chain of commands, as it currently stand, lacks the expressiveness of boolean operations. There are 2 approaches, either we allow sexp style syntax or a threading style. For example, calculators avoid that using [Reverse Polish Notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation). We don't need exactly that, we can do a [thread macro](https://clojure.org/guides/threading_macros) style of syntax. Some examples: - Sexp: `blue --pipeline=(and (or build repl) dist)` - Threading: `blue buid -> repl -- dist` - Sexp: `blue --pipeline=(or (and configure build) (and help repl))` - Threading: `blue configure -- build -> help -- repl` - Sexp: `blue --pipeline=(or (and configure build) (and clean build) report-bug repl)` - Threading: `blue configure -- build -> clean -- build -> report-bug -> repl` So with this notation, the status value is always passed to the next operator for checking what to do. The trick to reason about how to write the expressions is to think in CPS style. You reason about it from inside-out. So you think about the continuation of the operation. Unless I'm missing something, this should cover all cases.
Author
Owner
Copy link

My inclination is towards the threading style. It fit's better the shell syntax, as we would still be able to cleanly express command arguments, for example:
blue configure --prefix=$MY_INSTALL_LOCATION -- build docs -- install -> repl

My inclination is towards the threading style. It fit's better the shell syntax, as we would still be able to cleanly express command arguments, for example: `blue configure --prefix=$MY_INSTALL_LOCATION -- build docs -- install -> repl`
pastor added this to the alpha milestone 2026年05月08日 10:17:25 +02:00
Sign in to join this conversation.
No Branch/Tag specified
main
pipeline-operators
documentation
shadow-fields
instance-walker
blue-shell
promote-serializers-to-metacommands
pre-alpha
Labels
Clear labels
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
discussion
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
optimization
question
More information is needed
upstream
Related to an upstream repository, already reported there
bug
Something is not working
contribution welcome
Contributions are very welcome, get started here
duplicate
This issue or pull request already exists
enhancement
New feature
good first issue
Interested in contributing? Get started here.
help wanted
Need some help
invalid
Something is wrong
question
More information is needed
upstream
Related to an upstream repository, already reported there
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lapislazuli/blue#280
Reference in a new issue
lapislazuli/blue
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?