veged/xjst

Javascript-compatible syntax

Closed this issue · 5 comments

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)

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

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

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