YAML 1.2 仕様書リリース

YAML 1.2 の仕様書が正式公開されました。

YAMLメーリングリストに流れたClark C. Evansのメールに、今回の変更点が紹介されてました。それによると、今回の目玉はずばり「JSONの仕様を取り込む」ことです。つまり、YAML1.2からはYAMLJSONの完全なスーパーセットということになります。

今までもYAMLパーサをJSONパーサのかわりに使うことはできたのですが、実はYAMLJSONとで細かい差異があったため(特に「:」と「,」の直後の空白の有無)、YAMLパーサがすべてのJSONファイルをパースできたわけではありません。しかし今回の仕様変更で、YAMLパーサはすべてのJSONファイルを正しくパースできるようになりました。

The primary objective of the 1.2 revision of this specification is to bring YAML into compliance with JSON as an official subset. An expected source of incompatibility with prior versions of YAML, especially the syck implementation, is the change in implicit typing rules. We have removed odd and infrequent implicit rules and have updated these rules to align them with JSON's productions. In this version of YAML, boolean values may be serialized as ``true`` or ``false``; the empty scalar as ``null``. Unquoted numeric values are a superset of JSON's numeric production. Other changes in the specification were production bug fixes and defining 3 built-in implicit typing rule sets: untyped, strict JSON, and the default YAML typing.

The primary objective of the 1.1 revision of this specification was to fix problems with tagging rules. In particular the single exclamation was reserved for locally defined types and a simple prefixing mechanism was included to help usability. This revision also fixed numerous production edge cases and introduced a type repository.


なお個人的な意見としては、「別にJSONと非互換でもいいじゃん」です。これだけJSONパーサがたくさんあるのに、わざわざYAMLパーサをJSONパーサとして使う必要なんかないじゃん?