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

Allow 'chained functions' in top level call expressions #21

Open
stuartc opened this issue Feb 1, 2021 · 0 comments
Open

Allow 'chained functions' in top level call expressions #21

stuartc opened this issue Feb 1, 2021 · 0 comments

Comments

@stuartc
Copy link
Member

stuartc commented Feb 1, 2021

If you try and create an expression like this:

get(
  "http://localhost:9292?flip=left"
).then(console.log.bind(console))

Turns into:

(function() {
  return execute(get(
    "http://localhost:9292?flip=left"
  ).then(console.log.bind(console)))(state);
})();

The compiler attaches the ...(state) callExpression onto the .then instead of the operation. This makes sense given how everything was originally designed - however it would be really nice not to have to use alterState in order to do this.

What we really want is the compiler to know that (in this case), get is an operation that needs to be called with state and add the call expression to that instead:

(function() {
  return execute(get(
    "http://localhost:9292?flip=left"
  )(state).then(console.log.bind(console)));    // <== callExpression on Operation instead
})();
@stuartc stuartc added this to the Language Spec 2.0 milestone Feb 2, 2021
@taylordowns2000 taylordowns2000 removed this from the Language Spec 2.0 milestone Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants