-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Labels
Description
Using the README.md example as starting point:
var obj = { key: "hello" };
obj["newKey"] = "test";
console.log(obj);
If we add the newKey property after the console.log, it should not appear in the output.
var obj = { key: "hello" };
console.log(obj);
obj["newKey"] = "test";
However, ts2c include all properties in the C definition (not the actual problem) and take them all into account when the object is used. This change the program semantic.
The C program output for this case is
{ key: "hello", newKey: "(null)" }
but should be
{ key: "hello" }
since newKey do not exists when console.log is called. Just for comparison, this would not happen if the internal representation for objects were actually a dictionary (possibly with some performance penalties).