-
Notifications
You must be signed in to change notification settings - Fork 5
Embedded yaml
trans edited this page Nov 20, 2011
·
2 revisions
How might a programming language support embedded YAML?
A number of language's support HERE Documents. So that is a traditional way to embed YAML, e.g.
yaml = <<-YAML
a: 1
b: 2
YAML
But this a very superficial type of integration. It could be taken a step further with:
yaml = ---
a: 1
b: 2
...
But this really isn't much different from using a HERE doc, so why bother? Taking another step I purpose an embedded evaluation syntax.
a = 1
yaml = ---
a: <-{ a }
b: <-{ a + a }
...
Notice that this is not as simple a string interpolation. The actual return value of the evaluation is serialized into the YAML.
This would be part of the specification specifically for embedded applications.