|
|
|
|
|
by randomdata
1099 days ago
|
|
We are talking about how poor syntax pushes developers into some strange corners to avoid having to deal with the poor syntax. class ultimately gets you to a decent place, but forces the code into one big giant mess that nobody wants to look at ever again. Prototype function assignment gets you to the same place, with better syntax, but falls short for other reasons. Given: class Foo {
constructor(x) {
this.x = x
}
bar() {
return this.x
}
}
maybe it becomes: object Foo(x) {
this.x = x
}
function Foo.bar() {
return this.x
}
|
|