Hi,
we (my brother Josef and I) had a look at the YAML specification and wrote the
requirements draft that you find attached to this mail.
If you do not know, what YAML is, you can have a look at the examples in the
Symfony documentation. They use YAML as format for configuration files.
http://www.symfony-project.org/book/1_2/05-Configuring-Symfony
In fact, the draft mainly is a discussion of YAML and existing solutions. The
requirements part is very short. Also there are some questions in the draft.
As YAML has more usecases than just configuration files, we propose a
dedicated YAML component that could be integrated in other components.
Currently we prepare the design document which should hopefully be finished on
Wednesday. After the design process my brother will implement the component
and I will mentor him (discussions, review, ...).
If you have some issues with the requirements, tell us as soon as possible.
Have a nice evening
Thomas
--
Thomas Nunninger
Steinhalde 108
79117 Freiburg
Tel.: 0761 1201850
Mobil: 0163 7115153
http://nunninger.info
USt-IdNr: DE259832548
eZ components: Yaml (Requirements)
~~
:Author: Josef Roth (webmas...@josef-roth.com)
:Author: Thomas Nunninger (tho...@nunninger.info)
:Revision: $Rev$
:Date: $Date$
:Status: Draft
.. contents::
Scope
=
The scope of this documents is to describe the requirements of a new component
which will be able to read from and write to YAML streams.
Introduction
YAML_ (YAML Ain't Markup Language) "is a human friedly data serialization
standard for all programming languages." It is not restricted to reading from
resp. writing to files but each kind of stream can be used.
.. _YAML: http://yaml.org
YAML can be used for different use cases, e.g. configuration, simple documents,
data exchange, or logging. Therefore we decided to create a YAML component on
its own. The YAML component can be used by several other components like
Configuration, Document or EventLog to expand the possibilities of those
components to support the YAML format. As it is a dedicated component, it could
also be used in other projects easily.
Versions
There are two final versions of the YAML specification: 1.0 and 1.1.
Additionally there is a version 1.2 that is currently a working draft. Till now
it differs from YAML 1.1 in one single item, `line break characters`_: "YAML
version 1.1 did support the above line break characters; however, JSON does
not. Hence, to ensure JSON compatibility, YAML treats them as non-break
characters as of version 1.2. In theory this would cause incomatibility with
version 1.1; in practice these characters were rarely (if ever) used. YAML
processors parsing a version 1.1 document should therefore treat these line
breaks as non-break characters, with an appropriate warning.
.. _`line break characters`: http://yaml.org/spec/1.2/#id2574462
We want to support 1.0 and 1.1. But we are unsure about 1.2 as it is not final.
It would be nice to support the current state of 1.2 as it ensures JSON
compatibility. But what happens if the specification moves on and a new user
just reads: "YAML 1.2 (Working Draft 2008-05-11) support"? There could be wrong
expectations.
Existing Implementations
Many implementations in different languages exist (have a look on the YAML
website). There are different solutions for PHP that have some disadvantages:
- syck_: This is a PECL extension based on a C library which is not maintained
any more and that supports YAML 1.0 only. (There is another C library,
LibYAML_, that supports YAML 1.1 but there are no PHP bindings.)
- spyc_: It is available in version 0.3 and supports YAML 1.0 only.
- sfYaml_: Symfony's rewrite of spyc. But it does not cover the whole
specification and there is no information on which version it is based.
.. _syck: http://pecl.php.net/package/syck
.. _spyc: http://spyc.sourceforge.net/
.. _sfYaml: http://www.symfony-project.org/api/1_2/sfYaml
.. _LibYAML: http://pyyaml.org/wiki/LibYAML
Therefore we plan to write a PHP based YAML component.
Advantages:
- Easier (for us) then writing a PECL extension (based on the LibYAML).
(Probably it should be possible to replace the YAML parser and dumper if such
a PECL extension will be created sometimes.)
- No root privileges needed to install.
- Some additional stream related extensions for working with YAML beyond parse
and dump of the existing solutions.
Disadvantage:
- Probably it is somehow slower than plain C. But this should not be that
relevant for short documents. (And as written earlier: bindings to LibYAML
should be integrated easily if available.)
Requirements
- The component should parse and dump YAML structures of version 1.0, 1.1.
Perhaps 1.2 is supported as well.
- You should be able to define your own tag set to handle application specific
datatypes of nodes.
- You should be