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

Blocks description is misleading #84

Open
togakangaroo opened this issue Dec 21, 2016 · 2 comments
Open

Blocks description is misleading #84

togakangaroo opened this issue Dec 21, 2016 · 2 comments

Comments

@togakangaroo
Copy link

togakangaroo commented Dec 21, 2016

Blocks have been in js for a long time - they’re the reason

return
{
   foo: 123
}

breaks since it is interpreted as

return undefined;
{   //block
   foo:  //label
      123; //expression
}

That being said, blocks haven’t been very useful before due to lack of block scope, but that’s not different than the earlier discussion of let and const

Blocks don’t really do the same thing as IIFEs in enough situations to call then replacements I think. They will not limit var declarations, but more importantly they won't limit function declarations which will be hoisted into a higher scope

@DrkSephy
Copy link
Owner

You're absolutely right. Blocks don't cover all the situations to replace IIFEs, but they should be considered first. Maybe I can update the example to better reflect this - I'll think about a good way to phrase it.

@Zbigbear93
Copy link

Where are the latest comments

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

3 participants