SDL vs. YAML

Jacob Carlborg doob at me.com
Fri Sep 13 05:48:44 PDT 2013


On 2013-09-13 10:22, Sönke Ludwig wrote:

> I have to admit that looking at the examples *now* leaves me with a
> strong distaste for YAML. That wasn't the case in the beginning, but
> now, after not having looked at any YAML document since then and even
> with only the simplest syntax constructs used, it just looks confusing
> to me.
>
> Some points that stand out:
>
>   - Built-in field names and user defined dictionary key (can) look the
>     same and can be quite confusing (my initial reaction to the
>     "sub-package:" line in the example was "Hmm.. what kind of command
>     is *that*?")
>
>   - Indentation based scoping is much less explicit than braces. Someone
>     who has never seen the format may well think that it's just visual
>     formatting and has to read up on it first.
>
>   - It still has the deep nesting of the JSON format
>
>   - The complexity of the specification is a bit of a turn-off, too
>
> Having said that, YAML for sure is a nice format for many things and
> considerably more powerful in some areas than f.ex. SDL, but here I
> think the focus should be on the most concise and intuitive textual
> representation and IMO SDL does a better job there. More advanced
> features of YAML, if needed, can also easily be simulated with SDL.

Here's a lightly modified version of the YAML example:

name: my-package
description: A package for demonstration purposes
dependencies:
   vibe-d: ">=0.7.13"
   sub-package: { version: ~master}

configurations:
   # command line version
   - name: console
     targetType: executable
     versions: ConsoleApp

   # Win32 based GUI version
   - name: gui
     targetType: executable
     versions: UseWinMain
     libs-windows: [gdi32, user32]

I have used the inline format for "sub-package" and "libs-windows". I'm 
also assuming it's possible to use a single value instead of an array 
for "versions".

Don't know about SDL, but YAML allow you to have references, like this:

configurations:
   # command line version
   - name: console &console
     targetType: executable
     versions: ConsoleApp
     libs-windows: [gdi32, user32]

   # Win32 based GUI version
   - name: gui
     <<: *console
     versions: UseWinMain

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list