3 ms·
What does this show that @code_warntype doesn't?
by sdfghswe 3y ago
What does this show that @code_warntype doesn't?
- borodi 3y agoIt tries to show you the type information on the source itself, instead of on the IR.
- adgjlsfhk1 3y agoA few things. For me the most important is that it lets you easily explore the whole compile time call graph. (i.e if `h(x)=x*x` and `f(x)=h(x)`, Cthulhu will let you easily switch from looking at `f` to looking at `h` (think of it like compile time debugging). Cthulhu also has the equivalent of @code_llvm and @code_native.
- celrod 3y agoThis is extremely helpful when hunting for type instabilities. `@code_warntype` and `Cthulhu.@descend` can both show `SomePackage.foo` was inferred as `Any`. But why? Cthulhu lets you immediately descend, and see that it's because it calls `SomeOtherPackage.bar`, so you descend, and see... Five or ten calls in, you finally see a problem you can fix that can motivate a PR. This is fast to do with with `Cthulhu`. Descending is as easy as pressing `[enter]`, instead of requiring you to construct all the arguments and descend. Exploring the call graph while doing this gives you some overview of what the code is doing, and you can always look for the initial cause of propagating instabilities, instead of wading through a ton of JET output (but JET is also great).