brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 109 forks source link

Design a DSL for expessing runtime functions that still play nicely with the stack-management system #151

Closed blerner closed 6 years ago

blerner commented 10 years ago

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.

schanzer commented 6 years ago

@jpolitz would Stopify would obviate the need for this?

shriram commented 6 years ago

@schanzer That's what it's supposed to do. Simplifies library authoring. You write "normal" code, Stopify stopifies it.

shriram commented 6 years ago

But note that @blerner does not believe in Stopify. (-:

blerner commented 6 years ago

I am willing to believe :)

jswrenn commented 6 years ago

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.