3 ms·
And not less ideas that could improve usability of existing ones, like conditionals, loops and self-reference in object literals, { if (cond) set {a: 1}
by wruza 5y ago
And not less ideas that could improve usability of existing ones, like conditionals, loops and self-reference in object literals,
{
if (cond) set {a: 1},
for (x of values) set {[x.name]: x},
b: thisob.x,
c: {d: thisob.c},
}
enhanced data transfer,
dest.{a, b, [key]} = src
default values,
var x = arg ?? 1
optionality and mandatoryness,
var x = f?(…)?.info![key] ?? "<not found>"
scope objects and flow control in these,
function foo(a=1, b=2) {
scope bar {
let c = 3
scope {
let c = 4
log(a, b, bar.c, c)
baz(scope.this) // a, b, c, bar
baz(scope.arguments) // a, b
break bar
function environments,
global.{*} = {a:1, b:2}
var t = proxify({a:3, b:4}, global)
withenv (t) foo() // 3 4
function foo() {
console.log(a, b)
}
and so on. It seems everyone jumps on to “new same language” train when there is so much to do in what’s already not done.
- kwhitefoot 5y agoWe can get rid of the var and let keywords if we embrace single assignment like Erlang.