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

Update object-literals.md #172

Merged
merged 2 commits into from
Mar 11, 2017
Merged

Update object-literals.md #172

merged 2 commits into from
Mar 11, 2017

Conversation

sylvanc
Copy link
Contributor

@sylvanc sylvanc commented Mar 10, 2017

Cover implicit closing over free variables.

Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than one typo I noticed:

@@ -49,6 +49,17 @@ class Foo
end
```

We can also implicitly capture values from the lexical scope by using them in the object literal. Sometimes values that aren't local variables, aren't fields, and aren't parameters of a function are called _free variables_. By using them in a function, we are _closing over_ them - that is, capturing them. The code above could be written withouth the field `s`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here: s/withouth/without/.

@SeanTAllen
Copy link
Member

This corresponding ponyc change has been merged.

@SeanTAllen SeanTAllen merged commit e9d831e into master Mar 11, 2017
@SeanTAllen SeanTAllen deleted the implicit-capture branch March 11, 2017 00:50
@SeanTAllen
Copy link
Member

I fixed the typo that @jemc found, squashed and merged.

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

Successfully merging this pull request may close these issues.

3 participants