Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
Goblins - Racket implementation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
spritely
Goblins - Racket implementation
Commits
3ba29f9b
Verified
Commit
3ba29f9b
authored
5 years ago
by
Christine Lemmer-Webber
Browse files
Options
Downloads
Patches
Plain Diff
local promise chaining works!
parent
d083ca30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
goblins/core.rkt
+33
-8
33 additions, 8 deletions
goblins/core.rkt
with
33 additions
and
8 deletions
goblins/core.rkt
+
33
−
8
View file @
3ba29f9b
...
...
@@ -588,13 +588,20 @@
(
define
val
(
resolver-unsealer
sealed-val
))
;; Inform all listeners of the resolution
;; We'll do this unless we're symlinking to another promise,
;; in which case we just "pass on" the listeners.
(
define
(
inform-listeners
)
(
for
([
listener
(
mactor:local-promise-listeners
promise-mactor
)])
(
<-
listener
'fulfill
val
)))
;; Now we "become" that value!
(
match
val
;; It's a reference now, so let's set up a symlink
[(
?
refr?
)
;; for efficiency, let's make it as direct of a symlink
;; as possible
(
define
link-to
(
define
-values
(
link-to-refr
link-to-mactor
)
(
let
lp
([
refr-id
val
]
[
seen
(
seteq
)])
(
when
(
set-member?
seen
refr-id
)
...
...
@@ -606,17 +613,35 @@
(
set-add
seen
refr-id
))]
[
#f
(
error
"no actor with this id"
)]
;; ok we found a non-symlink refr
[
_
refr-id
])))
[
mactor
(
values
refr-id
mactor
)])))
;; Set up the symlink
(
actormap-set!
actormap
promise-id
(
mactor:symlink
link-to
))]
(
mactor:symlink
link-to-refr
))
;; Now we either inform listeners or forward them to the promise
(
match
link-to-mactor
;; Ok, it's a local promise...
;; For this we still need to set the symlink, but
;; we should defer our sending of messages until the
;; other promise resolves.
[(
mactor:local-promise
linked-listeners
linked-r-unsealer
linked-r-tm?
)
;; Update the symlinked-to-promise to have all of our listeners
(
define
new-linked-listeners
(
append
(
mactor:local-promise-listeners
promise-mactor
)
linked-listeners
))
(
define
new-linked-mactor
(
mactor:local-promise
new-linked-listeners
linked-r-unsealer
linked-r-tm?
))
(
actormap-set!
actormap
link-to-refr
new-linked-mactor
)]
;; Nope it's not a promise, so inform listeners now
[
_
(
inform-listeners
)])]
;; Must be something else then. Guess we'd better
;; encase it.
[
_
(
actormap-set!
actormap
promise-id
(
mactor:encased
val
))])
;; Inform all listeners of the resolution
(
for
([
listener
(
mactor:local-promise-listeners
promise-mactor
)])
(
<-
listener
'fulfill
val
))]
(
mactor:encased
val
))
(
inform-listeners
)])]
[
#f
(
error
"no actor with this id"
)]
[
_
(
error
"can only resolve a local-promise"
)]))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment