Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Genuinely: what are you talking about.

They added the get and set keywords to plain JS objects to identify getters and setters. So just add a dispose keyword. Like this:

    const obj = {
      log: ["a", "b", "c"],
      get first() {
        return this.log[0];
      },
      dispose cleanup() {
       // close resource
      } 
    };
Much cleaner.


Right, so instead of just grabbing a property by its well know unique name aka the entire point of symbols you need to first resolve the property descriptor, check a new completely unnecessary flag, and only then can you call the method. And of course that breaks if anyone either forgets the attribute or fails to check it when calling the parent method.

And you’re now wasting an entire keyword on a property with a fixed name, and code bases which already use that name with different semantics are unable to add `using` compatibility.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: