Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

let binding record and tuple should be writable #372

@magic-akari

Description

@magic-akari

As a JavaScript developer, I expect to see arrays and objects like primitive value, rather than ones that are completely not writable.
I expect modifying a partial value in tuple/record should update the whole value of tuple/record.

const foo = #[1, 2, 3];

let bar = foo;

console.log(foo === bar); // true
bar[1] = 5; // It's `let` binding. I think this is OK

console.log(foo === bar); // false

bar[1] = 2; // change back
console.log(foo === bar); // true

foo[1] = 5; // expect runtime error, foo is `const` binding!!!

/* It' similar to primitive value */
/* Think the above code as following */

const a = 1;

let b = a;

console.log(a === b); // true
b = 5;
console.log(a === b); // false
b = 1;
console.log(a === b); // true

a = 5; // runtime error!!!

code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions