querycert / qcert

Compilation and Verification of Data-Centric Languages
https://querycert.github.io/
Apache License 2.0
56 stars 9 forks source link

JavaScript & Java runtimes concatenate records the wrong way around #118

Closed jeromesimeon closed 5 years ago

jeromesimeon commented 5 years ago

The specification for record concatenation prioritizes on the right:

Screenshot 2019-10-07 at 11 44 23 AM

But the JavaScript runtime prioritizes on the left: https://github.com/querycert/qcert/blob/4095ca212e8ab67e655e43afb7ce5e2b96a09bf8/runtimes/javascript/qcert-runtime-core.js#L35

function concat(r1, r2) {
    var result = { };
    for (var key1 in r1)
    result[key1] = r1[key1];
    for (var key2 in r2)
    if (!(key2 in r1))
        result[key2] = r2[key2];
    return result;
}

That feels wrong at some level...

jeromesimeon commented 5 years ago

Fixed in PR #119