Re: [w3c/webcomponents] The comments on constructor conformance are somewhat redundant with the ES spec (#623)

It seems you might be misunderstanding the purpose of conformance requirements. These are things that you must do to write conformant code; they're not necessarily related to the language invariants.

> The first bullet is mostly redundant, since the language already does the right thing regarding this. All that really needs stated is that super() must be used without arguments. (It's not technically a function call, either.)

This is not correct. This is specifically saying that writing any code before your parameterless call to super() is non-conformant. That is a new requirement and is not redundant with the language.

> The second bullet should just say that only the current instance may be returned from the constructor, if any value is.

I think that is less clear than the current phrasing.

> The note right after step 8 is partially redundant and somewhat incorrect. The only way super() isn't called is if either 1. invocation throws or 2. something other than the current instance is returned (violating the invariants above), and this is enforced at the language level. The spec code does properly address this, though.

You should be looking at [the HTML Standard](https://html.spec.whatwg.org/#upgrades); the copy here is out of date, as the intro of the document notes.

Regardless, the entire point of this step is to handle what happens if non-conformant situations occur.

You also seem to misunderstand how super works. For example given

```js
class A {
  constructor() { console.log("a"); }
}

class B {
  constructor() {
    // no super()
  }
}
```

"a" will not be logged. So your two ways are not the only ways super() can be not-called.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/623#issuecomment-275870871

Received on Saturday, 28 January 2017 20:00:59 UTC