Closed blerner closed 6 years ago
@jpolitz would Stopify would obviate the need for this?
@schanzer That's what it's supposed to do. Simplifies library authoring. You write "normal" code, Stopify stopifies it.
But note that @blerner does not believe in Stopify. (-:
I am willing to believe :)
Even with Stopify, there are still opportunities for ergonomic improvements. Checking the arity and contracts of javascript-implemented function parameters involves writing frustratingly mechanical boilerplate and has been resistant to improvement (e.g., #1144).
There was an attempt to generate these checks with macros, but as far as I know, that didn't go anywhere.
Currently, to add a primitive function to the runtime, you have to be very careful: if the function never calls back into Pyret, you're ok, but if it even might, then you have to manually wrap the body of the function in a
try
/catch
that manually CPS'es the remaining control flow of the function. This is very tricky, easy to forget, and ought to be largely auomatable.