Closed theengineear closed 3 years ago
Here's an interesting thought related to analysis-time work. There does exist one-and-only-one hook in the HTMLElement class that you can depend on to be called before any this
of an element sees the light of day.
🥁 - rull
static get observedAttributes
!
I think this is actually pretty neat and leads me maybe change my mind about dispatching an error... I.e., I think maybe we should throw a halting error instead.
The observedAttributes
hook is cool because it:
this
yet, so we can't cheat even if we want to!super
since that's where we make sure reflected properties are observed.I'm going to update the description to reflect this change in opinion, I believe a history of edits is kept now, so feel free to peruse that if you need the context.
@klebba , you won me over on this one. Thanks for entertaining my bad idea 👍
Hah, it was not a bad idea! Glad you were able to work through both options
Currently, analysis work actually uses an instance (to resolve methods, etc). This allows us to dispatch errors at runtime instead of just throwing errors. Because we're not throwing halting errors, we're able to consider these errors non-fatal and move on.
In light of the comment below about the truly static
observeAttributes
hook and in light of discussions about making both computed methods and observers static #30, I propose we do cause a halting error.It will:
As long as analysis is truly static, you know that if an instance boots in development, it will boot in production, so it's not really possible to cause an error in production if you got the thing working in development.