Magic comments like `frozen_string_literal` may appear everywhere
within the first comment section while `encoding` have to be the first
line, or second line after shebang.
Pin matching for local variables and constants is already supported,
and it is fairly simple to add support for these variable types.
Note that pin matching for method calls is still not supported
without wrapping in parentheses (pin expressions). I think that's
for the best as method calls are far more complex (arguments/blocks).
Implements [Feature #17724]
Remove discussion of Ruby 2.7 specific handling of keyword
argument separation. Add a small example of keyword to
positional hash conversion for methods not accepting
keyword arguments.
* typos, grammar, formatting
* use `concrete_method` again in `regular_method` example,
to better distinguish from `forwarding_method` example
* clarify that leading arguments before `...` require Ruby 3.0
"experimental_everything" makes the assigned value, it means
the assignment change the state of assigned value.
"experimental_copy" tries to make a deep copy and make copyied object
sharable.
Add separate doc/syntax/pattern_matching.rdoc, add
link to control_expressions.rdoc.
The documentation is "reverse-engineered" from Ruby 2.7
behavior and early preview presentations, and corrected
by pattern-matching feature author @k-tsj.
In the grammar, all expressions are statements, but not all
statements are expressions. Some parts of the grammar accept
expressions and not other types of statements, which causes
similar looking code to parse differently due to operator
precedence.
Mostly from Dan0042 (Daniel DeLorme).
Fixes [Bug #16092]
Two advantages:
- higher relevance of the extremely common word "heredocs" which may
help people find this page when searching for "ruby heredocs"
- the anchor link becomes `#label-Here+Documents+-28heredocs-29`, which is
ugly due to the parentheses but includes the word "heredocs" in the URL to
this section
If anyone knows a way to prevent RDoc from turning invalid characters into
ugly and meaningless ASCII codes, I'm listening. I don't want to break existing
anchor links but RDoc should really ignore these characters or turn them into
dashes.
Closes: https://github.com/ruby/ruby/pull/2103