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

Can you give a short gist of why they're bad and why should one move out of classes/new? What is the alternative?


From the video:

    function constructor(spec) {
      let {member} = spec,
          {other}  = other_constructor(spec),
          method   = function () {
            // accesses member, other, method, spec
          };

      return Object.freeze({
          method,
          other,
      });
    }


That looks pretty interesting and flexible on one hand, on the other, I don't see why it's better than classes. Is it just more explicit?


Doesn't support inheritance.


its mostly because of 'this' . as per the example above, you can prevent this by doing something like that.. freeze/seal




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

Search: