dyaml/doc/html/articles/spec_differences.html

145 lines
6.8 KiB
HTML
Raw Normal View History

2011-08-16 12:53:13 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Differences between D:YAML and the YAML specification &mdash; D:YAML v0.3 documentation</title>
2011-08-16 12:53:13 +00:00
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.3',
2011-08-16 12:53:13 +00:00
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="D:YAML v0.3 documentation" href="../index.html" />
2011-08-16 12:53:13 +00:00
<link rel="prev" title="YAML syntax" href="../tutorials/yaml_syntax.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../tutorials/yaml_syntax.html" title="YAML syntax"
accesskey="P">previous</a></li>
<li><a href="../index.html">D:YAML v0.3 documentation</a> &raquo;</li>
2011-08-16 12:53:13 +00:00
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="differences-between-d-yaml-and-the-yaml-specification">
<h1>Differences between D:YAML and the YAML specification<a class="headerlink" href="#differences-between-d-yaml-and-the-yaml-specification" title="Permalink to this headline"></a></h1>
<p>There are some differences between D:YAML and the YAML 1.1 specification. Some
are caused by difficulty of implementation of some features, such as multiple
Unicode encodings within single stream, and some by unnecessary restrictions or
ambiguities in the specification.</p>
<p>Still, D:YAML tries to be as close to the specification as possible. It should
2011-08-16 12:53:13 +00:00
never load documents with different meaning than according to the specification,
and documents that fail to load should be very rare (for instance, very few
files use multiple Unicode encodings).</p>
<div class="section" id="list-of-known-differences">
<h2>List of known differences:<a class="headerlink" href="#list-of-known-differences" title="Permalink to this headline"></a></h2>
<p>Differences that can cause valid YAML documents not to load:</p>
<ul>
<li><p class="first">No support for byte order marks and multiple Unicode encodings in a stream.</p>
</li>
<li><p class="first">Plain scalars in flow context cannot contain <tt class="docutils literal"><span class="pre">,</span></tt>, <tt class="docutils literal"><span class="pre">:</span></tt> and <tt class="docutils literal"><span class="pre">?</span></tt>.
This might change with <tt class="docutils literal"><span class="pre">:</span></tt> in the future.
See <a class="reference external" href="http://pyyaml.org/wiki/YAMLColonInFlowContext">http://pyyaml.org/wiki/YAMLColonInFlowContext</a> for details.</p>
</li>
<li><p class="first">The specification does not restrict characters for anchors and
aliases. This may lead to problems, for instance, the document:</p>
<div class="highlight-yaml"><div class="highlight"><pre><span class="p-Indicator">[</span> <span class="nv">*alias</span><span class="p-Indicator">,</span> <span class="nv">value</span> <span class="p-Indicator">]</span>
</pre></div>
</div>
<p>can be interpteted in two ways, as:</p>
<div class="highlight-yaml"><div class="highlight"><pre><span class="p-Indicator">[</span> <span class="s">&quot;value&quot;</span> <span class="p-Indicator">]</span>
</pre></div>
</div>
<p>and:</p>
<div class="highlight-yaml"><div class="highlight"><pre><span class="p-Indicator">[</span> <span class="nv">*alias</span> <span class="p-Indicator">,</span> <span class="s">&quot;value&quot;</span> <span class="p-Indicator">]</span>
</pre></div>
</div>
<p>Therefore we restrict aliases and anchors to ASCII alphanumeric characters.</p>
</li>
<li><p class="first">The specification is confusing about tabs in plain scalars. We don&#8217;t use tabs
in plain scalars at all.</p>
</li>
<li><p class="first">There is no support for recursive data structures in DYAML.</p>
</li>
</ul>
<p>Other differences:</p>
<ul>
<li><p class="first">Indentation is ignored in the flow context, which is less restrictive than the
specification. This allows code such as:</p>
<div class="highlight-yaml"><div class="highlight"><pre><span class="l-Scalar-Plain">key</span><span class="p-Indicator">:</span> <span class="p-Indicator">{</span>
<span class="p-Indicator">}</span>
</pre></div>
</div>
</li>
<li><p class="first">Indentation rules for quoted scalars are loosed: They don&#8217;t need to adhere
indentation as <tt class="docutils literal"><span class="pre">&quot;</span></tt> and <tt class="docutils literal"><span class="pre">'</span></tt> clearly mark the beginning and the end of them.</p>
</li>
<li><p class="first">We allow <tt class="docutils literal"><span class="pre">_</span></tt> in tag handles.</p>
</li>
<li><p class="first">Right now, two mappings with the same contents but different orderings are
considered unequal, even if they are unordered mappings. This is because all
mappings are ordered in the D:YAML implementation. This should change in
future, once D associative arrays work with variant types or a map class or
struct appears in Phobos.</p>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/logo210.png" alt="Logo"/>
</a></p>
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Differences between D:YAML and the YAML specification</a><ul>
<li><a class="reference internal" href="#list-of-known-differences">List of known differences:</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../tutorials/yaml_syntax.html" title="YAML syntax"
>previous</a></li>
<li><a href="../index.html">D:YAML v0.3 documentation</a> &raquo;</li>
2011-08-16 12:53:13 +00:00
</ul>
</div>
<div class="footer">
&copy; Copyright 2011, Ferdinand Majerech. Based on PyYAML http://www.pyyaml.org by Kirill Simonov.
Last updated on Jan 23, 2012.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
2011-08-16 12:53:13 +00:00
</div>
</body>
</html>