diff options
author | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-05 07:48:25 -0400 |
commit | 435771d3c4d4ffa791805e7006ee3bde488a4090 (patch) | |
tree | 693b9e2a6d8c6ddf4e439336e5bfcd665c9955cd /stdlib/source/lux/concurrency/actor.lux | |
parent | 3de94c8a341ef3f19fd75eeeb98e5333d2fe89d0 (diff) |
- Improved the syntax for the "lux.function" macro.
Diffstat (limited to 'stdlib/source/lux/concurrency/actor.lux')
-rw-r--r-- | stdlib/source/lux/concurrency/actor.lux | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index c5bcc8a0d..ed62332a8 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -136,7 +136,7 @@ {#.doc "Kills the actor by sending a message that will kill it upon processing, but allows the actor to handle previous messages."} (All [s] (-> (Actor s) (IO Bool))) - (send (function [state self] + (send (function (_ state self) (task.throw Poisoned [])) actor)) @@ -219,7 +219,7 @@ output (message state self) #let [_ (log! "AFTER")]] (wrap output)))))} - (with-gensyms [g!init] + (with-gensyms [g!_ g!init] (do @ [module macro.current-module-name #let [g!type (code.local-symbol (state-name _name)) @@ -242,9 +242,10 @@ (` (~! ..default-handle)) (#.Some [[messageN stateN selfN] bodyC]) - (` (function [(~ (code.local-symbol messageN)) + (` (function ((~ g!_) + (~ (code.local-symbol messageN)) (~ (code.local-symbol stateN)) - (~ (code.local-symbol selfN))] + (~ (code.local-symbol selfN))) (do task.Monad<Task> [] (~ bodyC)))))) @@ -253,8 +254,9 @@ (` (~! ..default-end)) (#.Some [[causeN stateN] bodyC]) - (` (function [(~ (code.local-symbol causeN)) - (~ (code.local-symbol stateN))] + (` (function ((~ g!_) + (~ (code.local-symbol causeN)) + (~ (code.local-symbol stateN))) (do promise.Monad<Promise> [] (~ bodyC))))))})) @@ -305,7 +307,7 @@ (push [value a] state self (List a)) (let [state' (#.Cons value state)] (task.return [state' state']))))} - (with-gensyms [g!return g!error g!task g!sent?] + (with-gensyms [g!_ g!return g!error g!task g!sent?] (do @ [current-module macro.current-module-name actor-name (resolve-actor actor-name) @@ -331,7 +333,7 @@ (: (List Code)) (list.zip2 g!all-vars) (: (List [Code Code]))) - g!outputT (list/fold (function [[g!var g!ref] outputT] + g!outputT (list/fold (function (_ [g!var g!ref] outputT) (code.replace g!var g!ref outputT)) (get@ #output signature) ref-replacements)]] @@ -342,7 +344,7 @@ (All [(~+ g!all-vars)] (-> (~+ g!inputsT) (~ actorC) (Task (~ (get@ #output signature))))) (let [(~ g!task) (task.task (~ g!outputT))] (io.run (do io.Monad<IO> - [(~ g!sent?) (..send (function [(~ g!state) (~ g!self)] + [(~ g!sent?) (..send (function ((~ g!_) (~ g!state) (~ g!self)) (do promise.Monad<Promise> [(~ g!return) (: (Task [((~ g!type) (~+ g!actor-refs)) (~ g!outputT)]) |