Skip to content

feat: Add Functions tips scopes #1586

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

Merged
merged 10 commits into from
Sep 26, 2019
Merged

feat: Add Functions tips scopes #1586

merged 10 commits into from
Sep 26, 2019

Conversation

grant
Copy link
Contributor

@grant grant commented Sep 18, 2019

Adds a section on Function scopes

Bug: b/132734505
Accidentally closed here: #1561

@grant grant requested review from kurtisvg and a team September 18, 2019 15:36
@grant grant self-assigned this Sep 18, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 18, 2019

public class Scopes {
// [END functions_tips_scopes]
private static int lightComputation() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these functions are excluded from the snippet, this snippet is no longer copy-paste-runnable. If you remove the region tag excludes, you can move these functions below scopeDemo so that they are still part of the sample, but the user doesn't have to read them first.

This way the sample is still copy-paste-runnable, but the user doesn't have to read through the functions immediately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

None of the languages for functions_tips_scopes are copy-paste-runnable.

Do we want to either:

  • Keep the sample consistent
  • Include these functions but be inconsistent

Copy link
Contributor

Choose a reason for hiding this comment

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

We should include these functions. It's fine for older versions of samples to be grandfathered in, but we should aim to keep newer samples up to date with our guidelines, since they were created with the user in mind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Included the functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would still suggest moving them both below scopeDemo (since scopeDemo is really what you want the user to focus on).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Moved the functions location to the bottom of the class.


public class Scopes {
// [END functions_tips_scopes]
private static int lightComputation() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would still suggest moving them both below scopeDemo (since scopeDemo is really what you want the user to focus on).

@grant
Copy link
Contributor Author

grant commented Sep 23, 2019

Anyone can merge when tests pass.

@grant grant merged commit 632abc4 into master Sep 26, 2019
@grant grant deleted the functions_tips_scopes branch September 26, 2019 00:04
@grant grant mentioned this pull request Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants