From: Aaron Patterson Date: 2010-04-09T00:40:31+09:00 Subject: [ruby-core:29336] Re: [Bug #3112] require "yaml" doesn't use psych as default --vkogqOf2sHV7VnPd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 08, 2010 at 02:06:55PM +0900, Yui NARUSE wrote: > Issue #3112 has been updated by Yui NARUSE. >=20 >=20 >=20 > =3D Before > require 'yaml' and you can use YAML by syck. >=20 > =3D History > #2340 Removing YAML/Syck. > http://redmine.ruby-lang.org/issues/show/2340 >=20 > After imported psych, it is found that test-all conflicts. > To avoid this, yamler is introduced. > By yamler people can switch syck or psych (default is syck). >=20 > =3D Current > There is 3 element: > * lib/yaml.rb > * ext/syck > * ext/psych >=20 > =3D Q&A > Why psych is bundled: > * To review psych >=20 > Why psych is not default: > * it is not confirmed that it can be default in 1.9.2 > * it has some incompatibilities showed following. >=20 > Why syck is still bundled: > * for machines which libyaml is not installed > * for Windows >=20 > Incompatibilities are following, can you explain why it can't compatible,= Aaron? Yes! Many of these methods are exposing implementation specific details for syck. For example, the "detect_implicit" method detects whether a YAML string is an implicit or explicit string. "try_implicit" which attempts to use "detect_implicit". "object_maker" calls allocate on a class and sets instance variables based on a hash. These are clearly methods which should never be exposed as a public API. Other methods are deprecated because they are simply duplicates. For example, YAML.load_documents and YAML.each_document do _exactly_ the same t= hing. YAML.each_node and YAML.parse_documents do _exactly_ the same thing. On top of that, most of these methods are untested, which makes writing 100% compatible software impossible. All of these methods could be added to Psych, but it wouldn't be guaranteed that they work the same way as Syck. I understood from [ruby-core:28749], that Psych didn't need to have full compatibility. The best way I could think to warn users and maintain compatibility is to default to the old parser and let users choose to use the new one. > ext/syck/lib/syck.rb: YAML.generic_parser is deprecated, switch to psych" > ext/syck/lib/syck.rb: YAML.resolver is deprecated > ext/syck/lib/syck.rb: YAML.emitter is deprecated > ext/syck/lib/syck.rb: YAML.each_document is deprecated > ext/syck/lib/syck.rb: YAML.each_node is deprecated > ext/syck/lib/syck.rb: YAML.parse_documents is deprecated, use load_stream > ext/syck/lib/syck.rb: YAML.add_ruby_type is deprecated, use add_domain_ty > ext/syck/lib/syck.rb: YAML.add_private_type is deprecated, use add_domain > ext/syck/lib/syck.rb: YAML.detect_implicit is deprecated > ext/syck/lib/syck.rb: YAML.tagurize is deprecated > ext/syck/lib/syck.rb: YAML.transfer is deprecated > ext/syck/lib/syck.rb: YAML.try_implicit is deprecated > ext/syck/lib/syck.rb: YAML.read_type_class is deprecated > ext/syck/lib/syck.rb: YAML.object_maker is deprecated > ext/syck/lib/syck.rb: YAML.quick_emit is deprecated > ext/syck/lib/syck/basenode.rb: select is deprecated > ext/syck/lib/syck/basenode.rb: select!() is deprecated > ext/syck/lib/syck/basenode.rb: search() is deprecated > ext/syck/lib/syck/basenode.rb: at() is deprecated > ext/syck/lib/syck/basenode.rb: match_path is deprecated > ext/syck/lib/syck/basenode.rb: match_segment is deprecated > ext/syck/lib/syck/basenode.rb: children_with_index is deprecated, use > ext/syck/lib/syck/encoding.rb: YAML.escape is deprecated > ext/syck/lib/syck/encoding.rb: YAML.unescape is deprecated > ext/syck/lib/syck/stream.rb: edit is deprecated > ext/syck/lib/syck/stringio.rb: yaml/stringio is deprecated > ext/syck/lib/syck/ypath.rb: YAML::YPath is deprecated I am happy to add most of these to Psych, *if* Psych is going to be the default parser. I do not want to support these methods long term though. Please give me a clear direction, and I will make it happen. --=20 Aaron Patterson http://tenderlovemaking.com/ --vkogqOf2sHV7VnPd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJLvfjZAAoJEJUxcLy0/6/G310IAIILoxeUec4+A0sbeQo55NBh n9HtEmiPdMPB+Ru+4X4/BGGfZ7OaJndU9Li5maRplJAT9UQGc6CB5Lcy6JVH2R2O 20c+jzPXRlqNLuVspMUFWkilE4jPJTx+UAruK0eTgbC/8N6p6YeeFfQgt1CoEVIJ u+guCO15OET8ESgAgBEbB2HkaLcDtCfNKnKQORmApQL9nEb3JL+HCSZETp1hK3LM arvSVjUkdJau1rcT2unayvEm8j42Th2zxmGNFoTX1lWTTLkIuoQ0KjbiscbkefYp eUT7jXMBU1Uu9A9NJUp2QcINdTRYfV8Vpif7Gtj4rFhq9nY6XegkynM8jb0vNtI= =uDYE -----END PGP SIGNATURE----- --vkogqOf2sHV7VnPd--