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

Deprecate {{#each x as KEY}} in favor of {{#each x item=value num=index}} #300

Closed
James0x57 opened this Issue Sep 7, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@James0x57
Copy link
Contributor

commented Sep 7, 2017

The direction we're going with for aliasing #with scope here:
#274

Says that instead of using 'as', we should do handlebars-esque multi variable assignment using a hash:
{{#with first=person.first last=anotherPerson.last}}
meaning these are identical:
{{#with person}} === {{#with this=person}}


So the goal is:

  • to support this: {{#each items item=value num=index}}
  • and deprecate {{#each items as KEY}}

There is also a discussion about changing each-block aliasing here:
#289

@James0x57

This comment has been minimized.

Copy link
Contributor Author

commented Sep 7, 2017

Note: this is under discussion, not set in stone

@phillipskevin

This comment has been minimized.

Copy link
Contributor

commented Sep 8, 2017

I don't like that you would have to remember value and index are the correct keys.

It seems like this just adds things you have to remember without much benefit.

I like all of these better:

  • {{#each items item num}}
  • {{#each items with item num}}
  • {{#each items #with item num}}.
@phillipskevin

This comment has been minimized.

Copy link
Contributor

commented Sep 8, 2017

After talking about this, I think value/index as keywords for {{#each}} loops with arrays is fine. We will also need to reserve key for value/key for looping over objects.

@justinbmeyer justinbmeyer referenced this issue Sep 21, 2017

Closed

Replace *variable and %special with `scope` #304

2 of 2 tasks complete
@Macrofig

This comment has been minimized.

Copy link
Contributor

commented Sep 27, 2017

I'm going through the 3.11 tasks and without any context, this issue seems large; it seems to need some breaking down. So far, I can see,

  • Add deprecation warning when using {{#each VALUE as KEY}}
  • Create documentation for new API; blog post?
  • Update tests, update code (As clear as I can be without looking at can-stache)

Of course, this is all after the discussion leads to a decision on the api. Anyway, just want to leave a note that this needs to be broken down before points are assigned.

@Macrofig Macrofig self-assigned this Sep 28, 2017

@phillipskevin phillipskevin added the 3.0 label Sep 28, 2017

@phillipskevin phillipskevin referenced this issue Sep 28, 2017

Closed

can-stache 4.0 #289

20 of 30 tasks complete

phillipskevin added a commit that referenced this issue Oct 5, 2017

Merge pull request #320 from canjs/300-each-hash-expressions
Resolves #300: Update each helper to use hash expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.