aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/concurrency/actor.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-02-07 00:37:35 -0400
committerEduardo Julian2018-02-07 00:37:35 -0400
commit844a44f87bd03fc9c65e18149c6dd2ccf8e9cb32 (patch)
treed94e855ddf39c710f2cecf52f6e43851fdfb25d5 /stdlib/source/lux/concurrency/actor.lux
parent17d5280a5e05c70cdb0b2cf44606c186b000c7c1 (diff)
- Improved the way exceptions work.
Diffstat (limited to 'stdlib/source/lux/concurrency/actor.lux')
-rw-r--r--stdlib/source/lux/concurrency/actor.lux17
1 files changed, 10 insertions, 7 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux
index 4c98d10e4..c5bcc8a0d 100644
--- a/stdlib/source/lux/concurrency/actor.lux
+++ b/stdlib/source/lux/concurrency/actor.lux
@@ -20,7 +20,11 @@
[task #+ Task]))
(exception: #export Poisoned)
-(exception: #export Dead)
+
+(exception: #export (Dead {actor-name Text}
+ {message-name Text})
+ (format " Actor: " actor-name "\n"
+ "Message: " message-name "\n"))
## [Types]
(with-expansions
@@ -133,7 +137,7 @@
but allows the actor to handle previous messages."}
(All [s] (-> (Actor s) (IO Bool)))
(send (function [state self]
- (task.throw Poisoned ""))
+ (task.throw Poisoned []))
actor))
## [Syntax]
@@ -263,7 +267,7 @@
(type: Signature
{#vars (List Text)
#name Text
- #inputs (List [Text Code])
+ #inputs (List cs.Typed-Input)
#state Text
#self Text
#output Code})
@@ -311,7 +315,7 @@
g!actor-vars (list/map code.local-symbol actor-vars)
actorC (` ((~ (code.symbol actor-name)) (~+ g!actor-vars)))
g!all-vars (|> (get@ #vars signature) (list/map code.local-symbol) (list/compose g!actor-vars))
- g!inputsC (|> (get@ #inputs signature) (list/map (|>> product.left code.local-symbol)))
+ g!inputsC (|> (get@ #inputs signature) (list/map product.left))
g!inputsT (|> (get@ #inputs signature) (list/map product.right))
g!state (|> signature (get@ #state) code.local-symbol)
g!self (|> signature (get@ #self) code.local-symbol)
@@ -357,8 +361,7 @@
(~ g!self))]
(if (~ g!sent?)
((~' wrap) (~ g!task))
- ((~' wrap) (<| (task.throw ..Dead)
- (~ (code.text (format " Actor: " (%ident actor-name) "\n"
- "Message: " (%ident message-name) "\n")))))))))))
+ ((~' wrap) (task.throw ..Dead [(~ (code.text (%ident actor-name)))
+ (~ (code.text (%ident message-name)))]))))))))
))
)))