My wish-list for the next YAML

YAML is both universally used, and universally reviled. It has a lot of problems, but it also is so useful in solving specific tasks that it’s hard to replace. Some new kids on the block (such as TOML) have successfully taken over a portion of its market share, but it remains in force in places where those alternatives show their weaknesses.

I think it’s clear to most that YAML is in dire need of replacement, which is why many have tried. But many have also failed. So what are the key features of YAML which demonstrate its strengths, and key weaknesses that could be improved upon?

Let’s start with some things that YAML does well, which will have to be preserved.

tasks:
- configure: |
jit_flags=""
if [ "$(uname -m)" != "x86_64" ]
then
    jit_flags=--without-jit
fi
./configure \
    --prefix=/usr \
    $jit_flags
- build: |
make
- test: |
make check

What needs to be improved upon?

Consider the following YAML list:

items:
- hello
- 24
- world

Two of these are strings, and one is a number. Representing numbers and strings plainly like this makes it easier for humans to write, though requiring humans to write their values in a format which provides an unambiguous type is not so inconvenient as to save this trait from the cutting room floor. Leaving the ambiguity in place, without any redress, provides a major source of bugs in programs that consume YAML.

Someday I may design something like this myself, but I’m really hoping that someone else does it instead. Good luck!

   \ \_____
###[==_____>
   /_/

“My wish-list for the next YAML” was published on July 28, 2021.

Back to the home page

View “My wish-list for the next YAML” on the WWW

The content for this site is CC-BY-SA. The code for this site is MIT.