Project

General

Profile

Actions

Bug #17410

closed

One-line pattern-matching deprecation is lost on singular variable assignment

Added by zverok (Victor Shepelev) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:101540]

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 3 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 3 years ago

  • Status changed from Open to Closed

It is intentional.

https://github.com/ruby/dev-meeting-log/blob/master/DevelopersMeeting20201210Japan.md#feature-17371-reintroduce-expr-in-pat-ktsj

ktsj: How about allowing the typical r-assign case as an official (not experimental) feature?

matz: go ahead

Updated by zverok (Victor Shepelev) over 3 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

Also available in: Atom PDF

Like0
Like0Like0Like0