tc39 / proposal-record-tuple

ECMAScript proposal for the Record and Tuple value types. | Stage 2: it will change!
https://tc39.es/proposal-record-tuple/
2.48k stars 62 forks source link

sliced is not a function #301

Closed dotnetCarpenter closed 2 years ago

dotnetCarpenter commented 2 years ago

"I was looking for sliced but it was a half measure!" Source

Joke aside, there is an error in the first "playground" example under Tuple. On line 10, ...measures.sliced(0, measures.length - 1), MUST be ...measures.slice(0, measures.length - 1),.

PS. For the love of ... please space function calls! Scheme developers figured that out in the 70s ;)

// Accessing indices like you would with arrays!
console.log (measures[0]); // 42
console.log (measures[3]); // measure error: foo happened

// Slice and spread like arrays!
const correctedMeasures = #[
  ...measures.slice (0, measures.length - 1),
  -1
];

Much nicer.

ljharb commented 2 years ago

The typo is appreciated, but that’s not a style that’s idiomatic for virtually the entire JavaScript ecosystem (and subjectively, not nicer at all to me).

acutmore commented 2 years ago

thanks for spotting this. PR raised https://github.com/tc39/proposal-record-tuple/pull/302

dotnetCarpenter commented 2 years ago

Virtually the entire JavaScript ecosystem is used to change @ljharb 😃 OK OK.. I'll stop joking now. You are completely right about idiomatic js. But I still hope for change and more spaces.

dotnetCarpenter commented 2 years ago

sorry.. should have kept open until #302 is merged...