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

Fix modern documentation to mention emit_arg_inside_procarg0 #658

Merged
merged 1 commit into from Mar 16, 2020

Conversation

mbj
Copy link
Collaborator

@mbj mbj commented Mar 15, 2020

  • Fix documentation of modern AST format to include
    emit_arg_inside_procarg0. This allows users to mirror what
    Parser::Builders::Default.modernize does.

- Fix documentation of modern AST format to include
  emit_arg_inside_procarg0. This allows users to mirror what
  `Parser::Builders::Default.modernize` does.
@mbj
Copy link
Collaborator Author

mbj commented Mar 15, 2020

BTW I think it would also make sense to add a public API for the effect of Parser::Builder::Default.modernize or make that method part of the public documented API.

I'm happy to do so in a followup.

@mbj
Copy link
Collaborator Author

mbj commented Mar 15, 2020

@whitequark, @iliabylich I've not contributed to parser in a long time. So I'm not sure if it was correct to tag you both for review. Sorry If I caused noise. Pls tell me if I overstep with that review request.

Parser::Builders::Default.emit_procarg0 = true
Parser::Builders::Default.emit_encoding = true
Parser::Builders::Default.emit_index = true
Parser::Builders::Default.emit_lambda = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a good idea to add some comments explaining what those options do.

Copy link
Owner

Choose a reason for hiding this comment

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

There is documentation right above explaining what these options do.

Copy link
Contributor

Choose a reason for hiding this comment

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

The documentation in the backwards compatibility section is extremely generic and doesn't mention any of the options specifically. I'm pretty sure most newcomers would have try some trouble trying to figure out what some of the more weird options mean.

Copy link
Owner

Choose a reason for hiding this comment

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

The fact that we even have these options is a consequence of our errors in judgement earlier. They should never be turned off explicitly, and in particular newcomers shouldn't set them to any other value. If someone really wants to know what they do, reading the source is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. :-) This can also be made clearer in the docs, but I guess it's not a big deal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They should never be turned off explicitly, and in particular newcomers shouldn't set them to any other value.

That is the reason I propose to expose a (or the) #modernize method and document it. It removes even needing to know the details of what modernize means.

Copy link
Owner

Choose a reason for hiding this comment

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

That is the reason I propose to expose a (or the) #modernize method and document it.

That's impossible. Ever changing what that method does would break backwards compatibility, thus defeating the purpose of having it in first place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's impossible. Ever changing what that method does would break backwards compatibility, thus defeating the purpose of having it in first place.

True. The method itself would have to be versioned, defeating the propose.
For my use cases I'll probably detect "malformed from not modernized" ASTs and reject them early.

Okay, so can we merge the PR as is? I think its an incremental improvement over the current state.

Copy link
Collaborator

@iliabylich iliabylich left a comment

Choose a reason for hiding this comment

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

Thanks!

@iliabylich iliabylich merged commit e5c421b into master Mar 16, 2020
@iliabylich iliabylich deleted the fix/modern-ast-format-documentation branch March 16, 2020 11:54
@mbj
Copy link
Collaborator Author

mbj commented Mar 16, 2020

Thanks for review / merge.

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.

None yet

4 participants