Wolfram may not have inline caches or GC but it has lots of super interesting things that JS doesn’t have. Must be a fun system to work on!
Wolfram may not have inline caches or GC but it has lots of super interesting things that JS doesn’t have. Must be a fun system to work on!
When you give it a non-negative argument, the counter increases by one; when you give it a negative argument you get the message of it reverting to the uncompiled evaluation and the counter increases by two.
I've never used Wolfram in earnest (touched it once in undergrad ever so briefly) so I may be misunderstanding.
EDIT: I see that the documentation for FunctionCompile indicates it's for pure functions only.https://reference.wolfram.com/language/ref/FunctionCompile.h...
The older Compile function also does the same thing when there's an error.
Given the difficulties of doing something fancier, I think it's a reasonable strategy. Mutating state that doesn't originate in a function isn't too common, and less so with the kinds of functions you'd compile. If the compiled function fails, you probably have some other bug in your code anyways.
Since Wolfram Language uses referencing counting instead, it doesn't need all of that complexity; it just has to insert MemoryAcquire/MemoryRelease at the appropriate spots in the IR.