title: More complex inheritance in YAML?
body: <p>YAML has inheritance. The most clear example I have ever seen is here: <a href="https://web.archive.org/web/20130213112648/http://blog.101ideas.cz/posts/dry-your-yaml-files.html" rel="noreferrer">http://blog.101ideas.cz/posts/dry-your-yaml-files.html</a></p>
  
  <p>I need something more complex: I need to override object's object's property. Here is an example: </p>
  
  
  
  <pre><code>database: &amp;default
    server:
      ip: 192.168.1.5
      port: 2000
    db_name: test
    user: 
      name: root
      password: root
  
  # database foo differs from default by only its port and user password
  foo_database:
    &lt;&lt;: *default
    server:
      port: 2001
    db_name: foo
    user:
      password: foo_root
  </code></pre>
  
  <p>I want to get this result: </p>
  
  <pre><code>foo_database.server.ip -&gt; 192.168.1.5
  foo_database.server.port -&gt; 2001
  foo_database.db_name -&gt; foo
  foo_database.user.name -&gt; root
  foo_database.user.password -&gt; foo_root
  </code></pre>
  
  <p>But if you declare like this, you will get these properties incorrect (according to expected values):</p>
  
  <pre><code>foo_database.server.ip -&gt; will be None
  foo_database.user.name -&gt; will be None
  </code></pre>
  
  <p>because new "server" object has only "port" property and it overrides whole old "server" object. </p>
  
  <p>How do I get the kind of inheritance which I want to achieve? </p>
  
  <h1>Edit</h1>
  
  <p><a href="https://gist.github.com/ceremcem/4ca8d774e660c579682839620d8c2da8" rel="noreferrer">Here is</a> my exact intention with a working code in <a href="http://livescript.net/" rel="noreferrer">LiveScript</a>:</p>
  
  
  
  <pre><code>config = 
    default: 
      ip: \192.168.1.5
      port: 2000
      name: \root 
      password: \root 
      db:
        name: \default
        location: \LA
  
    foo-database:~ -&gt; @default `merge` do 
      ip: \11.11.11.11
      db:
        name: \my-foo 
  
    bar-database:~ -&gt; @foo-database `merge` do 
      password: \1234 
      db:
        location: \SF
  
  config.default 
  # =&gt; {"ip":"192.168.1.5","port":2000,"name":"root","password":"root","db":{"name":"default","location":"LA"}}
  config.foo-database  
  # =&gt; {"ip":"11.11.11.11","port":2000,"name":"root","password":"root","db":{"name":"my-foo","location":"LA"}}
  config.bar-database  
  # =&gt; {"ip":"11.11.11.11","port":2000,"name":"root","password":"1234","db":{"name":"my-foo","location":"SF"}}
  </code></pre>