From: zverok.offline@... Date: 2020-10-02T09:22:15+00:00 Subject: [ruby-core:100278] [Ruby master Feature#17210] More readable and useful `Set#inspect` Issue #17210 has been updated by zverok (Victor Shepelev). BTW, as a side note, it would be good to have some "style guide" for inspect behavior in Ruby. Ad-hoc rule seem to be `#` most of the time, except for objects that have corresponding literals -- they are just represented by literals. But: * how the "content" should be represented, is not always consistent from class to class: ` #`, `#`, `#`, `#`, `#`, ``, `#` * of core objects, say, the `Time` is breaking all conventions being represented as `2020-10-02 12:10:51 +0300` -- which even doesn't look as one atomic entity * of all stdlib I've checked, only `matrix` does similar to proposed: `Matrix[[25, 93], [-1, 66]]`, `Vector[1, 2]`, so it is a bit unusual for `#inspect`, though it is not necessary a bad thng ---------------------------------------- Feature #17210: More readable and useful `Set#inspect` https://bugs.ruby-lang.org/issues/17210#change-87865 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: knu (Akinori MUSHA) ---------------------------------------- I would like to change `Set#inspect`/`to_s`: ```ruby # before puts Set[1,2,3] # => "#" # after puts Set[1,2,3] # => "Set[1, 2, 3]" ``` This output is shorter, readable, and has the property that it corresponds to Ruby code -- https://bugs.ruby-lang.org/ Unsubscribe: