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

Javascript-compatible syntax #18

Closed
indutny opened this issue Jan 29, 2013 · 5 comments
Closed

Javascript-compatible syntax #18

indutny opened this issue Jan 29, 2013 · 5 comments

Comments

@indutny
Copy link
Collaborator

indutny commented Jan 29, 2013

Now:

template(this.x === '1' && this.y === '2') {
  var x = apply();
  return x + local(this.y = 3) applyNext();
}

Should be:

template(this.x === '1', this.y === '2')(function() {
  var x = apply(this)();
  return x + local(this)({ y: 3 })(function() {
    return applyNext(this)();
  });
});

Basics

template(pred1, pred2, ..., pred3)(body)

local(context)(local_change1, ..., local_changeN)

apply(context)(local_change1, ..., local_changeN)

@indutny
Copy link
Collaborator Author

indutny commented Jan 29, 2013

/cc @veged

@indutny
Copy link
Collaborator Author

indutny commented Jan 30, 2013

Example of runtime: https://gist.github.com/8b8d86fcad29a1bd19d2

@veged
Copy link
Owner

veged commented Mar 28, 2013

local can be written as local()(local_change1, ..., local_changeN)(bodyFunction) (use this as default context).
apply better live without context argument (is most common case) and for custom context apply we can use local+apply

@veged
Copy link
Owner

veged commented May 31, 2013

В какой версии это уже есть? Тикет можно же закрыть?

@indutny
Copy link
Collaborator Author

indutny commented May 31, 2013

В 0.7.x, сейчас смержу в мастер.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants