This repository was archived by the owner on Feb 19, 2018. It is now read-only.
This repository was archived by the owner on Feb 19, 2018. It is now read-only.
CS2 Discussion: Output: Destructuring assignment #18
Closed
Description
Destructuring assignment
the example from the CS-hompage run with CS 1.10 / browser(chrome) / latest
futurists =
sculptor: "Umberto Boccioni"
painter: "Vladimir Burliuk"
poet:
name: "F.T. Marinetti"
address: [
"Via Roma 42R"
"Bellagio, Italy 22021"
]
{poet: {name, address: [street, city]}} = futurists
console.log futurists
console.log "'street' defined ?", street?, (street if street?)
console.log "'poet' defined ?", poet?, (poet if poet?)
console.log "broken CS ? why is 'poet' in 'ref' ?", eval('ref').name
I'm bringing this up, 'cos i can't figue out the current the status of 'destructuring assignments'.
I'm not sure if that is expected behaviour. I'd expect 'poet' to be avail in local-scope.
There has been some discussions during 2013 at CS-github.issues.page eg. Issue 3500, Issue 3225
I'd like to be able to assign to a local var :
b = {}
b.{poet: {name, address: [street, city]}} = futurists
This has been proposed before - the regarding issue(s) is/are solved | closed. The status is unclear to me ?
So i vote for it in CS6.