zaphar / ucg

A Universal Configuration Grammar
Apache License 2.0
36 stars 3 forks source link

Allow self references in a copy statement #3

Closed zaphar closed 5 years ago

zaphar commented 5 years ago

When doing a tuple copy it would be nice to be able to do copies of other tuple fields.

example syntax:

let nested = {
inner = {
        foo = "bar",
    },
};

let copy = nested{
    inner = self.inner{
        quux = "baz",
    },
};

This would make tuple composition a lot cleaner than the current mechanism of

let nested = {
inner = {
        foo = "bar",
    },
};

let innercopy = nested.inner{
    quux = "baz",
};

let copy = nested{
    inner = innercopy,
};