Actions
Feature #21389
closedSimplify Set#inspect output
Feature #21389:
Simplify Set#inspect output
Description
As Set is now a core collection class, it should have special inspect output. Ideally, inspect output should be suitable to eval, similar to array and hash (assuming the elements are also suitable to eval):
The simplest way to do this is to use the Set[] syntax:
I've submitted a pull request that implements this: https://github.com/ruby/ruby/pull/13488
The pull request deliberately does not use any subclass name in the output, similar to array and hash. I think it is more important that users know they are dealing with a set than which subclass:
However, it's easy to change the PR to use a subclass name if that is desired.
Actions