Issue #17143 has been updated by jeremyevans0 (Jeremy Evans).


matz (Yukihiro Matsumoto) wrote in #note-5:
> Adding category to the warning seems a good idea. But I have the following concerns:
> 
> * Category should be specified only by symbols

OK, this change has already been made.

> * Category symbols must be among predefined set (to avoid typos and confusions)

I'll make this change.  I'll start with only `:deprecated` being allowed, since that is already used.  Future commits can add support for other symbols.


shyouhei (Shyouhei Urabe) wrote in #note-6:
> - I'm not against adding the category keyword.  However,
> - I guess it is quite hard for us to +1 the "Add categories for all core warnings" commit at once.
>     - It might contain OK changes, but might also contain questionable ones.
>     - Do you really need to do this in a big changeset like this?  Can you split it into each categories, and let us consider case-by-case?

I can split the commit into separate commits per category.  I'll focus on the categories I think are most important first and submit separate pull requests for those.

----------------------------------------
Feature #17143: Improve support for warning categories
https://bugs.ruby-lang.org/issues/17143#change-87730

* Author: jeremyevans0 (Jeremy Evans)
* Status: Open
* Priority: Normal
----------------------------------------
Support was recently added for Warning.warn to accept a `category` keyword.  However, the initial implementation was limited to having `rb_warn_deprecated` and `rb_warn_deprecated_to_remove` use the `:deprecated` value for the `category` keyword.

It doesn't make sense to me to have a `category` keyword if it is only used for deprecation, so I propose we extend the support so that `Kernel#warn` accepts a category keyword (for Ruby-level warnings) and `rb_category_warn` and `rb_category_warning` functions be added to the C-API (for C-level warnings).  I also propose that we change existing `rb_warn` and `rb_warning` calls to `rb_category_warn` and `rb_category_warning`, so that all warnings issued by core Ruby are issued with an appropriate category.

I have implemented support for this in a pull request: https://github.com/ruby/ruby/pull/3508



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>