Unlimited block scopes
I like the idea of scopes which have the limited ability to be read-from and or written-into in order to perform secure operations
A ***blockscope*** would have this functionality
blockscope[ [params [, params]*]* ]{
}
let a = "a"
let a2 = "a2"
let a3 = "a3"
let b,c = blockscope[ let innerScopeA = a ]{
a // referenceError: "a" is undefined
a2 // referenceError: "a2" is undefined
a3 // referenceError: "a3" is undefined
innerScopeA // "a"
let B = "B"
let C = "C"
return B,C
}
innerScopeA // referenceError: "innerScopeA" is undefined
blockscope[ a,b,c,f = Worker("myfile.js") ]{
innerScopeA // referenceError: "innerScopeA" is undefined
a // "a"
b // "B"
c // "C"
let msg = f.postMessage(a,b,c)
let d = blockscope[]{
let D = "D"
blockscope[]{
let e = "e"
blockscope[]{
let g = "g"
}
}
return D
}
d // "D"
}
d // referenceError: "d" is undefined
cf. RELATED REFERENCES
SANDBOXED SCOPED FUNCTIONS - Sandboxed / Scoped function
REALMS PROPOSAL - https://github.com/tc39/proposal-realms