From: "vo.x (Vit Ondruch) via ruby-core" Date: 2024-07-24T19:00:52+00:00 Subject: [ruby-core:118679] [Ruby master Bug#20433] Hash.inspect for some hash returns syntax invalid representation Issue #20433 has been updated by vo.x (Vit Ondruch). matz (Yukihiro Matsumoto) wrote in #note-10: > IMO, this is a good chance to upgrade Hash#inspect format to adopt current Hash usage. > > * symbol keys should be represented by "`key:`" I wish we stayed with the hash rockets, sigh ---------------------------------------- Bug #20433: Hash.inspect for some hash returns syntax invalid representation https://bugs.ruby-lang.org/issues/20433#change-109216 * Author: tompng (tomoya ishida) * Status: Open * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- For these hashes, Hash.inspect returns a syntax invalid representation: ~~~ruby { :a! => 1 } # {:a!=>1} { :a? => 1 } # {:a?=>1} { :* => 1 } # {:*=>1} { :== => 1 } # {:===>1} { :< => 1 } # {:<=>1} ~~~ `eval(hash.inspect)` will raise SyntaxError. Although inspect does not guarantee that the result can be eval-ed, it'd be confusing for these few cases. Maybe related to https://bugs.ruby-lang.org/issues/20235 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/