compiler: syntactic sugar for combine
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 23
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 17
Description
One thing that's very hard to do in job writing is do muliple steps in one.
each is the usual usecase, where I want to do:
each($.data, get, fn, post)
Where what I really want in the each is a little pipeline which processes each item through multiple operations
I can do this today with promises:
each($.data, get.then(fn).then(post))
But it's ugly, the compiler creaks, and error handling isn't great
You can also use combine, which is cool but no-one knows about it:
each($.data, combine(get(), fn(), post()))
I'm just wondering if we can do some syntactic sugar for combine, like:
each($.data, [get, fn, post])
But we probably can't distinguish this piping sort of expression from an array.
What if we used something more like piping?
each($.data, get |> fn |> post)
each($.data, get | fn | post)
each($.data, get > fn > post)
each($.data, @[get,fn , post])
Not terribly neat or intuitive.
using a pipe is OK but the synax isn't reserved, so how would I catch it?
JS does have a proposal for a pipeline operator: https://github.com/tc39/proposal-pipeline-operator
So it's this then:
each($.data, get |> fn |> post)
The compiler detects the chain and compiles it to:
each($.data, combine(get, fn, post))
You cannot use the pipe operator inside a block statement. Use it only in place of an operation.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test entry point is named. Start by reviewing the compiler's operation-expression handling and the existing combine implementation, then compare the proposed pipe syntax with the linked TC39 pipeline proposal. Done means agreeing on valid syntax, compiling the chain to combine, and defining the block-statement restriction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100