Skip to content

Commit

Permalink
Fix promise examples so that they compile
Browse files Browse the repository at this point in the history
  • Loading branch information
enilsen16 authored and SeanTAllen committed Aug 8, 2018
1 parent c92e121 commit a22e910
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/promises/promise.pony
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PrintFulfill is Fulfill[String, String]
_env = env
_msg = msg
fun apply(s: String): String =>
_env.out.print(" + ".join([s; _msg]))
_env.out.print(" + ".join([s; _msg].values()))
s
actor Main
Expand Down Expand Up @@ -86,7 +86,7 @@ actor Main
.next[Array[USize] val](recover Computation~strings_to_sizes() end)
.next[USize](recover Computation~sizes_to_avg() end)
.next[None](recover Computation~output(env) end)
promise(" ".join(env.args.slice(1)))
promise(" ".join(env.args.slice(1).values()))
```
"""
use "time"
Expand Down Expand Up @@ -167,7 +167,7 @@ actor Promise[A: Any #share]
promise is also rejected.
"""
let p' = Promise[(A, B)]

let c =
object
var _a: (A | _None) = _None
Expand Down Expand Up @@ -241,7 +241,7 @@ actor Promise[A: Any #share]
object tag
var _complete: Bool = false
let _p: Promise[(A, Promise[A])] = p'

be apply(a: A, p: Promise[A]) =>
if not _complete then
_p((a, p))
Expand All @@ -251,7 +251,7 @@ actor Promise[A: Any #share]

next[None]({(a) => s(a, p) })
p.next[None]({(a)(p = this) => s(a, p) })

p'

fun tag timeout(expiration: U64) =>
Expand Down

0 comments on commit a22e910

Please sign in to comment.