Feature #16420


Added by znz (Kazuhiro NISHIYAMA) about 1 year ago. Updated about 1 year ago.

Target version:


Current master always warn pattern matching syntax.
It discourage users try them.

Another noisy warnings can stop by Warning[:deprecated]=false.

So I think the future may be more useful if Warning[:experimental]=false or Warning[:pattern_matching]=false can stop warnings.

Updated by shevegen (Robert A. Heiler) about 1 year ago

Although I can not say whether the specific API proposed here is useful or not (matz may just
have to decide on the API for general use), I agree with the statement of controlling/toggling
the "noise" level, based on different needs by the ruby user - some prefer warnings, which is
fine, whereas others may prefer less warnings (or just suppress some warnings specifically
while allowing others to show up).

I do not have an alternative API proposal, but the suggestions here make sense to me.

I think :deprecated and :pattern_matching is simple to understand; for :experimental, it may
have to be defined clearly what exactly is to be considered experimental and what is not, since
this may change between ruby versions.

Perhaps there should be some way to query from ruby which specific features are experimental
or not, e. g. an Array of symbols or something like that. That way the ruby user can make
conditional checks and enable/disable certain features selectively (or not), or rather the
warnings for such experimental features, on a per gem/project basis too - but I digress.

In short I think the suggestion by znz makes sense.


Updated by naruse (Yui NARUSE) about 1 year ago

  • Target version set to 2.7

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|07e595fdbd75ed44473073cdf8cd758572d11709.

Added experimental warning category

[Feature #16420]

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

Changing the flag at runtime causes problems, mainly editors' syntax highlighting, ruby -c etc.

How about a new "magic comment" pragma?

# -*- experimental-syntax: true -*-

or, more strictly

# -*- experimental-syntax: pattern-matching -*-

Also available in: Atom PDF