SDL vs. YAML

Sönke Ludwig sludwig at outerproduct.org
Fri Sep 13 09:09:08 PDT 2013


Am 13.09.2013 14:48, schrieb Jacob Carlborg:
> 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".

That does indeed improve it. But I still think that the multitude of 
formatting options can be confusing and it takes more artistic skills to 
get a nice result than with a single clean way to format.

>
> 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
>

That's where IMO it gets hairy. It's for sure a highly useful feature, 
but also completely impossible to understand without consulting the 
documentation. SDL doesn't have direct support, but it would be possible 
build some kind of custom functionality if it proves useful.

Something like:

def somevar="somevalue"
libs "$somevar"

or

template "sometemplate" {
   libs "gdi32" "user32"
}

configuration "gui" {
   mixin "sometemplate"
}


More information about the Digitalmars-d mailing list