Skip to content

Commit

Permalink
Set version to 8.0.446
Browse files Browse the repository at this point in the history
  • Loading branch information
niwinz committed Feb 23, 2022
1 parent e7b4c2c commit 2f01336
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 222 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog #


## Version 8.0.446

Date: 2022-02-23

- Make `promise?` to check for IPromise protocol instead of concrete types. Now it should
more easy extend promise to other promise like types.
- Rename `promise.core/do!` macro to `promise.core/do` (backward compatible, previous
macro still in the codebase)
- Add promise aware `with-redefs` macro (thanks to @eccentric-j)


## Version 7.0.444

Date: 2022-02-22
Expand Down
2 changes: 1 addition & 1 deletion build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[cljs.build.api :as api]))

(def lib 'funcool/promesa)
(def version (format "7.0.%s" (b/git-count-revs nil)))
(def version (format "8.0.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def jar-file (format "target/%s-%s.jar" (name lib) version))
Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

:build
{:extra-deps
{io.github.clojure/tools.build {:git/tag "v0.7.5" :git/sha "34727f7"}}
{io.github.clojure/tools.build {:git/tag "v0.7.7" :git/sha "1474ad6"}}
:ns-default build}

:outdated
Expand Down
30 changes: 15 additions & 15 deletions doc/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ A promise library for Clojure and ClojureScript.
Leiningen:

```clojure
[funcool/promesa "7.0.444"]
[funcool/promesa "8.0.446"]
```

deps.edn:

```clojure
funcool/promesa {:mvn/version "7.0.444"}
funcool/promesa {:mvn/version "8.0.446"}
```

On the JVM platform _promesa_ is built on top of *completable futures*
Expand Down Expand Up @@ -104,30 +104,30 @@ if you want to execute it asynchronously, you can provide an executor:
;; => 1
```

Another way to create a promise is using the `do!` macro:
Another way to create a promise is using the `do` macro:

```clojure
(p/do!
(p/do
(let [a (rand-int 10)
b (rand-int 10)]
(+ a b)))
```

The `do!` macro works similarly to clojure's `do` block, so you can
The `do` macro works similarly to clojure's `do` block, so you can
provide any expression, but only the last one will be returned. That
expression can be a plain value or another promise.

If an exception is raised inside the `do!` block, it will return the
If an exception is raised inside the `do` block, it will return the
rejected promise instead of re-raising the exception on the stack.

If the `do!` contains more than one expression, each expression will
If the `do` contains more than one expression, each expression will
be treated as a promise expression and will be executed sequentially,
each awaiting the resolution of the prior expression.

For example, this `do!` macro:
For example, this `do` macro:

```clojure
(p/do! (expr1)
(p/do (expr1)
(expr2)
(expr3))
```
Expand Down Expand Up @@ -399,6 +399,12 @@ some computation inside the composed promise chain/pipeline raises an
exception, the pipeline short-circuits and propagates the exception to
the last promise in the chain.

The `catch` function adds a new handler to the promise chain that will
be called when any of the previous promises in the chain are rejected
or an exception is raised. The `catch` function also returns a promise
that will be resolved or rejected depending on what happens inside the
catch handler.

Let see an example:

```clojure
Expand All @@ -407,12 +413,6 @@ Let see an example:
(.log js/console error))))
```

The `catch` function adds a new handler to the promise chain that will
be called when any of the previous promises in the chain are rejected
or an exception is raised. The `catch` function also returns a promise
that will be resolved or rejected depending on what happens inside the
catch handler.

If you prefer `map`-like parameter ordering, the `err` function (and
`error` alias) works in same way as `catch` but has parameters ordered
like `map`:
Expand Down
Loading

0 comments on commit 2f01336

Please sign in to comment.