| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This is going to break ASON. Why is __instanceof being removed? There doesn't seem like a logical reason for this to occur. |
Sorry, something went wrong.
|
It's a change resulting from #2548, where remaining open issues with interfaces have been tackled as well that required a more sophisticated approach to implement instanceof to also support interfaces. It's now compiler generated. In turn, the old mechanism to perform these checks became unused, and as such redundant. Can you explain the use case a little? Perhaps there are ways to support it otherwise. |
Sorry, something went wrong.
abstract class BaseClass {}
class MyClass extends BaseClass {}
ASON.deserialize<BaseClass>(buffer); // no longer can validate a serialized MyClassThis breaks the entirety of the as-lunatic package and I would have to ask end users of ASON to do this: let result = ASON.deserialize<BaseClass>(); // oh no it's an Array
assert(result instanceof BaseClass); // not ergonomic and backwards uncompatible
Okay. I understand. Sorry for not understanding. I just feel like I have no workarounds for this. |
Sorry, something went wrong.
|
Can ASON.deserialize<T> perhaps do: function deserialize<T>(...) {
let ret = ...;
if (ret instanceof T) ... // AS allows this
} |
Sorry, something went wrong.
|
The assert would panic if it isn't an instanceof T... let me try that. |
Sorry, something went wrong.
|
I guess one question there is what is used as the type of ret so this doesn't become precomputed, hmm. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The compiler no longer depends on embedded RTTI, in particular base class ids (see #2548, where instanceof helpers are now compiler-generated). There are still two uses of RTTI outside of the compiler itself, though: One is to determine pointer-free objects during GC, and the other is the loader, that both rely on type flags. The pointer-free use case is important enough to at least keep the flags, so this PR slashes RTTI in half, removing the base class id alongside the now unused programmatic __instanceof helper.