Actions
Bug #17410
closedOne-line pattern-matching deprecation is lost on singular variable assignment
Description
Is this intentional? Probably an effect of changing the behavior of warning categories?
RUBY_REVISION
# => "1ba8d63b49318e5682a22502c5f5b70e3298da8f"
[1, 2, 3] => [x, *]
# (irb):8: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
1 => x
# ....no deprecation...
Updated by marcandre (Marc-Andre Lafortune) over 4 years ago
Matz can confirm, but I think it's ok. 1 => x
can never not match and is there to stay. [1, 2, 3] => [x, *]
is probably more subject to change (what happens if no match, what is acceptable syntax), although I happen to think it's simply brilliant.
Updated by mame (Yusuke Endoh) over 4 years ago
- Status changed from Open to Closed
It is intentional.
ktsj: How about allowing the typical r-assign case as an official (not experimental) feature?
matz: go ahead
Updated by zverok (Victor Shepelev) over 4 years ago
Thanks, @mame (Yusuke Endoh)!
(Sorry for a huge amount of tickets from me, I just really need to understand the quirks and reasoning clearly to explain in docs and changelogs.)
Actions
Like0
Like0Like0Like0