Skip to end of metadata
Go to start of metadata

Q: Is SDL trying to replace XML? What is the relationship?

SDL is not trying to replace XML. XML is an excellent format for marking up documents, describing metadata, mixing tags in free form text, and many other applications.

XML is also commonly used for properties files, configuration files, and object serialization. For these purposes, SDL offers a terser and more perspicuous syntax. SDL is type aware and allows datastructures such as lists, maps, and trees to be easily represented.

Lets look at a snippet from a configuration file represented in both languages.

XML
<path id="prog.src">
    <pathelement path="${src.dir}" />
    <pathelement path="${res.dir}" />
    <pathelement path="${external.src.dir}" />
</path>

<target name="prog.tests" depends="prog.build" echo="true">
    <java classname="org.ikayzo.sdl.PackageTests" failonerror="true" dir="${basedir}/test" fork="true">
        <arg value="-d" />
        <arg value="${basedir}/test" />
    </java>
</target>
The SDL equivalent is shorter, more readable, and type aware:
 
paths "prog.src" {
    "${src.dir}" "${res.dir}" "${external.src.dir}"  
}

target "prog.tests" depends="prog.build" echo=on {
    java "-d" "${basedir}/test" "org.ikayzo.sdl.PackageTests" failonerror=true \
        dir="${basedir}/test" fork=true
}
Tip: Boolean Literals

on and off can be used as boolean literals.

Q: How mature is SDL? Is it safe to use on my project?

SDL 1.0 was released in 2005. It is in use on a number of large projects and is actively maintained by multiple contributors. There are no known bugs. Of course, the normal disclaimers apply (see the code comments for details.)

Q: Can I use SDL with older versions of Java (pre Java 5)?

SDL for Java uses new language extensions introduced in Java 5 such as generics, annotations, etc. The included binaries will only work with Java 5, but you can backport the library to Java 1.4 using Retroweaver.

Q: Can I use SDL with older versions of C#?

SDL for .NET requires C# 2.0. We don't currently have plans to provide support for earlier versions, but if you would like to contribute a backport, please let us know.

Q: I have a question about SDL. Who can help me?

Post your question to the SDL mailing list. Most questions are answered within 24 hours.

Q: Is the SDL library thread-safe?

The central SDL Tag data structure is not thread-safe. It is up to you to handle thread safety in a way most appropriate to your application. If multiple threads have access to a tree of Tags its a good idea to synchronize on the root Tag.

Q: If tags are nested to very deep levels, doesn't the lack of a closing name cause confusion?

It is our experience that for most purposes SDL doesn't need to be nested as deeply as XML (because of the value lists, anonymous tags, etc.) If you need deeply nested SDL tags you can add a simple comment to the close bracket to avoid confusion.

tag1 {
    tag2 {
        tag3 {
        }
    } # tag2
} # tag1

Q: Does the order of values, attributes, or children in a Tag matter?

The order of values and children is significant. They are modelled as lists so duplicates are allowed and the order in which they are listed is maintained in the model. The order of attributes is not significant. Only one instance of an attribute key is allowed in a given tag. See the Language Guide for details.

Q: Why don't you add <insert suggested literal type>?

We are trying to keep SDL true to its name by including only very commonly needed literal types. We are considering adding a reference and scalar range type to SDL 2.0, but that is about it.

Q: Have you heard of <insert related language>? Why wasn't it good enough?

If it is listed in the references section of the Language Guide, then yes, we have heard of it. Similar declarative languages like YAML met some but not all of our design goals. YAML code such as:

!!map {
  ? !!str "---"
  : !!str "foo",
  ? !!str "...",
  : !!str "bar"
}

does not seem very natural in the modern language landscape. We feel SDL's type inference from "natural" looking literals similar to those found in C or Java is preferable. SDL maps (attributes) and lists look similar to analogous constructs in popular scripting languages.

Additionally, SDL was designed to cleanly map to and from XML. This is not true for all the languages in our references list.

Q: I want to contribute to SDL. Who do I talk to?

If you have a patch to SDL for Java or SDL for .NET, or if you are interested in porting the SDL library to a new language please email the developers list. If you make significant high quality contributions we will give you commit privileges to the subversion repository.

Labels: