Closed DarkWiiPlayer closed 5 years ago
Seems reasonable, and it shouldn't be that hard to implement if you'd like to take a pass at putting together a PR.
Both options seem trivial to implement; which one would be preferable though?
I'd just make printstats
call compile
since it's normally something people would do for debugging so taking the hit (in time to wait for compilation to finish) shouldn't affect any large codes.
Sounds reasonable; my was that compiling a function is a side effect and I personally prefer debug functionality to be free of side effect, so the programs behavior doesn't change from adding / removing a debug output. Correct me if I'm wrong, but after defining a function (and before compiling it) you can change other things that will affect the function, right?
This is less true than it used to be now that we use eager type checking (though possibly we may go back to being a little lazier at some point).
I think the key question is whether printstats
is something that would be useful even if the function were not compiled? Like the disas
function is clearly not, so it just compiles the function for you if it isn't already. I'd be inclined to put printstats
in this category as well.
Merged the PR. Thanks again!
This code produces a useless error message
Which wouldn't help at all in a more complex codebase where it's harder to figure out at which point a function is actually compiled.
It would make sense to either compile the function automatically when
printstats
is called on a yet uncompiled function, or to just returnnil
+ error message so as to not crash the entire program.