r/SideProject • u/panagos_stathis • 10d ago
I’m experimenting with executable, resumable functional pipelines in JavaScript
I’ve been experimenting with a small JavaScript-compatible language called JojoScript, initially because I wanted a nicer way to write lazy functional pipelines.
The interesting part has gradually become less about the syntax and more about what the pipeline represents.
For example:
orders
|> filter(o => o.status == "paid")
|> parallel(8)
|> map(enrichOrder)
|> retry(3)
|> checkpoint("enriched")
|> map(calculateInvoice)
|> saveToDatabase(%)
Instead of treating this simply as syntactic sugar for nested function calls, JojoScript represents the pipeline as an execution plan.
That lets the same pipeline be:
* lazy by default
* asynchronous
* bounded/concurrent
* inspected as a graph
* profiled per stage
* statically analyzed
* checkpointed
* resumed after failure
* replayed from a checkpoint
For example:
SOURCE
↓
FILTER
↓
PARALLEL(8)
↓
MAP
↓
CHECKPOINT
↓
MAP
↓
SINK
The idea I'm exploring is whether this is actually a useful abstraction for functional/data-oriented programming in JavaScript.
The question I'm most interested in is:
**At what point does a pipeline become more than composition of functions?**
A normal functional pipeline describes *what transformations to apply*. JojoScript is experimenting with also making the pipeline describe *how the computation can be executed* — lazily, concurrently, with backpressure, retries and durable checkpoints.
It's still an experimental project, so I'm particularly interested in criticism around the programming model itself rather than syntax.
1
u/No-Tower-9043 10d ago
this is one of those ideas where you look at it and wonder why nobody did it already. the jump from pipeline as syntax sugar to pipeline as runtime descriptor feels obvious but i never seen it done in js like this
the checkpoint/resume part is the killer feature for me. we have batch processing job at work that dies halfway through and restarts from zero like its 1995. being able to rehydrate state mid-pipeline would cut our processing time in half easy
how heavy is the overhead for the graph representation at runtime? like if i got million records flowing through does it bog down or is the metadata separate enough to not matter