Ah, found what I was originally thinking of: it’s the “@stable” macro by @giordano in the Seven Lines of Julia thread:
Simeon’s is a bit robuster indeed, with the $tmp.
@simeonschaub I was also wondering, why the Base.mapany
(and not just map
)?
↓
EDIT: I found why here (in the SnoopCompile docs) (maybe):
mapany
avoids trying to narrow the type off(v[i])
and just assumes it will beAny
, thereby avoiding invalidations of manyconvert
methods.
So, it’s used to spare the compiler some type inference work and/or to avoid convert
invalidations, I think
The final thing I wonder about is the @nospecialize:
all Exprs are the same type, so there is no “too many specializations” problem right?
Like, why not say rewrite_assignment(ex::Expr)
.
And why the Meta.isexpr(ex, …)
instead of just ex.head == …
?
↓
Ah, these are to handle LineNumberNode
s, I assume.
Still, how is the @nospecialize useful?