Use assignment instead of destructuring to avoid invalidations#60807
Use assignment instead of destructuring to avoid invalidations#60807JamesWrigley wants to merge 1 commit intoJuliaLang:masterfrom
Conversation
For some reason destructuring caused the `argtypes` variable to be boxed, which led to everything else using it being inferred as `Any`, making the code vulnerable to invalidations.
|
I've done fixes like this before, and the proper fix is usually elsewhere in the method body. The root cause could, for example, be some type instability, perhaps related to closure capture boxing. Off-topic gripe: too bad that maintainability suffers from the style in which the code is written, making this into a neverending game of whack-a-mole, with some other type instability likely to happen again sooner or later in the same method. IMO it would be good to switch to a style that:
|
|
Oops, actually I made a mistake here and applied the fix to the wrong function because I made the change on a different machine... In fact you already fixed this exact problem with |
For some reason destructuring caused the
argtypesvariable to be boxed, which led to everything else using it being inferred asAny, making the code vulnerable to invalidations.Tested on 1.12 because Cthulhu doesn't work on nightly ATM. Mostly fixes these invalidations from DimensionalData:
Which went down to:
Typed code from Cthulhu without the patch
Discovered when looking into rafaqz/DimensionalData.jl#1046.