-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Quote promise macro #54
Comments
Possible solution - first one: '>(Promise.reject (new Error "zonk")) this will quote the promise. tranlsate into (quote-promise (Promise.reject (new Error "zonk")))
|
Good news that reject in fact throw exception, so it's normal that it break from expression. (try
(let ((x (Promise.reject (new Error "zonk")))
(y (Promise.resolve 10)))
(+ y y))
(catch (e)
(display "YES")))
YES |
This is not a bug, so the issue is now to create Note that expression that wrap promise is also a promise. |
Add await function and quote-promise Add new parser extension '> for quote promise Refactor new function names to snake case
Example of usage for reference: lips> (--> '>(fetch "https://terminal.jcubic.pl")
(then (lambda (res) (res.text)))
(then (lambda (text)
(print (. (text.match #/<title>([^>]+)<\/title>/) 1)))))
lips> (await (--> '>(fetch "https://terminal.jcubic.pl")
(then (lambda (res) (res.text)))
(then (lambda (text)
(. (text.match #/<title>([^>]+)<\/title>/) 1))))) |
Here is problematic code:
second promise is ignored because first rejects, this will print error "zonk" in terminal (looks better on the web).
TODO:
Need to figure out how to make it work. Possible solutions are:
The text was updated successfully, but these errors were encountered: