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

Function composition models pipelines #304

Closed
mlanza opened this issue May 20, 2024 · 2 comments
Closed

Function composition models pipelines #304

mlanza opened this issue May 20, 2024 · 2 comments

Comments

@mlanza
Copy link

mlanza commented May 20, 2024

Let's start with the standard F# pipeline as implemented by Babel:

const a = x 
  |> f(?, 1)
  |> g
  |> h

This gives you a where x, some value, is passed down the pipeline. Function composition syntax can be similarly achieved.

const y = // x is omitted 
  |> f(?, 1)
  |> g
  |> h

//this syntax is equivalent to:

const y = comp(h, g, f(?, 1));  

/* so that... */

const a = y(x);

Given a basic pipeline syntax, one drops the initial input argument and, conveniently, ends up with a composed function. This makes sense given that function composition and pipelines are so closely related.

There should be little reason, once the pipeline syntax is settled, that function composition syntax couldn't tag along.

@snatvb
Copy link

snatvb commented May 21, 2024

question symbol aready assiciated with optional, better than sharp - # I don't know, maybe is percent(%) could be, but # looks better and don't uses as math opeator, that can confuse

const y = // x is omitted 
  |> f(#, 1)
  |> g
  |> h

@bogdanbiv
Copy link

bogdanbiv commented Aug 5, 2024

The F# pipeline proposal was already rejected by TC39 several times.
The topic topic (?, # or %) is being discussed in another issue ( #91 ).

Mind you, the issue of a topic token is stuck because no one is able to find a reasonable proposal. We are down to two characters topic tokens and we're still stuck. One character tokens (all of: @#$%?) have already been hashed to bits (no pun intended here). Please do check if your topic token has already been discussed.

As a developer interested in this proposal I also tried to contribute ideas to the topic token, but it seems some have found my proposals as if I were digging in the cemetery for corpses of old discussions :-). I'm telling you this to understand the experience you will receive. People are already tired of the discussion of picking a topic token, which effectively kills this proposal :-(.

This being said I would recommend closing this issue, as there is nothing to be further discussed here.

@mlanza mlanza closed this as completed Aug 5, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants