-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors can be reported as residual goals #6
Comments
I'm not sure if we can express this in a nice way with the variable substitution format the response currently uses 🤔 IIRC, the way Tau does this is it reports either a map of substitutions or a goal corresponding to the thrown ball, but this leads to kind of an ugly API situation where the response shape can be totally different, so you have to use a helper function ( |
I never thought about errors being conceptually the same as residual goals though, that's actually kind of mind blowing, haha. |
In the latest release you can use the Prolog format to get this.
const goal = await pl.queryOnce("throw(t).", {format: "prolog"});
// goal = "throw(t)." |
Closing as done because the Prolog format toplevel report answers the same as regular Trealla now. I would like to further improve the uniformity by splitting the variable dump: #20. |
For example, in Scryer Prolog, we get:
Note that exceptions are reported "uniformly" as residual goals, much like constraints and answer substitutions, using the predicates
error/2
andthrow/1
.This may be worth considering in the API design. It is related to #4.
The text was updated successfully, but these errors were encountered: