8sync.git
7 years agotests: Call msg-receive, not msg-recieve
Christopher Allan Webber [Mon, 12 Dec 2016 17:20:36 +0000 (11:20 -0600)]
tests: Call msg-receive, not msg-recieve

* tests/test-actors.scm: Fix test calls to msg-receive (was typo'ed).

7 years agotests: Update test-actors to use msg-recieve instead of =>.
Christopher Allan Webber [Mon, 12 Dec 2016 15:09:52 +0000 (09:09 -0600)]
tests: Update test-actors to use msg-recieve instead of =>.

It feels like msg-recieve is an easier to read name, and looks less
like a structure used elsewhere (the way => is used in cond).

* tests/test-actors.scm: Update to switch => to msg-recieve.

7 years agoactors: Move message body to being an argument list for procedures.
Christopher Allan Webber [Mon, 12 Dec 2016 01:20:38 +0000 (19:20 -0600)]
actors: Move message body to being an argument list for procedures.

This also removes the whole define-mhandler, mlambda, etc stuff... as
well as message-ref, since the argument list can be just about anything.

* 8sync/systems/actors.scm (<message>, message-deferred-reply)
  (set-message-deferred-reply!, make-message, serialize-message)
  (serialize-message-pretty, read-message): Removed deferred-reply slot from
  <message>.
  (message-ref, %nothing-provided, with-message-args, mlambda)
  (define-mhandler): Removed.
  (message-needs-reply?): Renamed from message-needs-reply, removed
  reference to message-deferred-reply.
  (message-auto-reply?, <-auto-reply, call-with-message, msg-receive, =>):
  New procedures / macros.
  (<-, <-wait, <-reply, <-reply-wait, simple-dispatcher, hive-reply-with-error):
  Update to pass in arguments as an argument list.
  (%expand-action-item): Remove optional "inline" message handler form.
  (hive-process-message): Update for rename of message-needs-reply?;
  use <-auto-reply where appropriate, check for an action of
  either *reply* or *auto-reply*.

* tests/test-actors.scm: Adjust tests to meet new structure.

7 years agoagenda: Move install-suspendable-ports! call to start-agenda.
Christopher Allan Webber [Mon, 12 Dec 2016 01:18:47 +0000 (19:18 -0600)]
agenda: Move install-suspendable-ports! call to start-agenda.

* 8sync/agenda.scm: Remove install-suspendable-ports! call from top level.
  (start-agenda): Move install-suspendable-ports! here.

7 years agoactors: Make the <-* message sending procedures official, not aliases.
Christopher Allan Webber [Sun, 11 Dec 2016 17:14:25 +0000 (11:14 -0600)]
actors: Make the <-* message sending procedures official, not aliases.

* 8sync/systems/actors.scm (send-message, send-message-wait)
  (reply-message, reply-message-wait): Removed.
  (<-, <-wait, <-reply, <-reply-wait): Converted from being aliases
  to being the official procedure names.

7 years agoagenda: Fix 8sleep's time parameter.
Christopher Allan Webber [Sun, 11 Dec 2016 17:13:18 +0000 (11:13 -0600)]
agenda: Fix 8sleep's time parameter.

* 8sync/agenda.scm (8sleep): Wrap time parameter in tdelta before passing
  to make-run-request.

7 years agoactors: Removing deprecated comment. new-world-order
Christopher Allan Webber [Sun, 11 Dec 2016 16:27:36 +0000 (10:27 -0600)]
actors: Removing deprecated comment.

* 8sync/systems/actors.scm (<message>): Removing deprecated comment
  about replied and deferred-reply slots not being used, since we use
  them now.

7 years agoactors: Remove deprecated call to former "8sync" definition
Christopher Allan Webber [Sat, 10 Dec 2016 22:16:08 +0000 (16:16 -0600)]
actors: Remove deprecated call to former "8sync" definition

These used the old meaning of 8sync, where something would happen
asynchronously but return its value.

* 8sync/systems/actors.scm (hive-create-actor, hive-create-actor*): Remove
  call to 8sync, just call its previous body on its own.

7 years agoagenda: Cut out huge swath of old 8sync-* procedures/macros.
Christopher Allan Webber [Sat, 10 Dec 2016 16:40:20 +0000 (10:40 -0600)]
agenda: Cut out huge swath of old 8sync-* procedures/macros.

* 8sync/agenda.scm (<wrapped-exception, make-wrapped-exception)
  (wrapped-exception?, wrapped-exception-key, wrapped-exception-args)
  (wrapped-exception-stacks, propagate-%async-exceptions, 8sync-run)
  (8sync-run-at, 8sync-run-delay, 8sync-delay): Removed.
  (8sync): Update to allow for multiple statements in body.
  (8sleep): Rewrite to not depend on 8sync-delay.
* tests/test-agenda.scm: Remove test for 8sync-delay.

7 years agoagenda: Add yield procedure.
Christopher Allan Webber [Sat, 10 Dec 2016 03:03:47 +0000 (21:03 -0600)]
agenda: Add yield procedure.

* 8sync/agenda.scm (yield): New variable.

7 years agoagenda: Rename 8sync-nowait to 8sync.
Christopher Allan Webber [Fri, 9 Dec 2016 21:57:25 +0000 (15:57 -0600)]
agenda: Rename 8sync-nowait to 8sync.

* 8sync/agenda.scm (8sync-nowait, 8sync): Renamed 8sync-nowait to 8sync.
* 8sync/systems/actors.scm (send-message, reply-message hive-reply-with-error):
  Switch calls of 8sync-nowait to 8sync.

7 years agoagenda: Remove 8sync macro.
Christopher Allan Webber [Fri, 9 Dec 2016 20:47:47 +0000 (14:47 -0600)]
agenda: Remove 8sync macro.

Despite being the namesake of the project, this turns out to have never
really been important or made sense, except as a way to yield control as
a form of context switching.  This is moving towards renaming
8sync-nowait to 8sync, a forthcoming change.

* 8sync/agenda.scm (8sync, catch-8sync): Removed.
* tests/test-agenda.scm: Removed all tests calling the 8sync macro.

7 years agoAdd comment noting that the "web" system needs a rewrite. wip-suspendable-ports
Christopher Allan Webber [Fri, 9 Dec 2016 17:16:39 +0000 (11:16 -0600)]
Add comment noting that the "web" system needs a rewrite.

* 8sync/systems/web.scm: Add comment/TODO item about using deprecated code.

7 years agoirc: Update IRC code to use simpler suspendable ports system.
Christopher Allan Webber [Thu, 8 Dec 2016 21:43:15 +0000 (15:43 -0600)]
irc: Update IRC code to use simpler suspendable ports system.

* 8sync/systems/irc.scm (irc-socket-setup): Set port to be non-blocking.
  (install-socket, make-basic-irc-handler): Remove.
  (irc-loop): New procedure; uses the Guile read-line code to switch
  from the former manual-buffering of make-basic-irc-handler to simply
  using Guile's read-line utility.
  (queue-and-start-irc-agenda!): Use irc-loop.

7 years agoagenda: Remove call to deprecated agenda-except-port-map procedure.
Christopher Allan Webber [Thu, 8 Dec 2016 21:37:43 +0000 (15:37 -0600)]
agenda: Remove call to deprecated agenda-except-port-map procedure.

* 8sync/agenda.scm (update-agenda-from-select!): Remove call to deprecated
  agenda-except-port-map procedure.

7 years agoagenda: Remove debugging statements.
Christopher Allan Webber [Thu, 8 Dec 2016 21:29:58 +0000 (15:29 -0600)]
agenda: Remove debugging statements.

* 8sync/agenda.scm (wait-for-readable, wait-for-writable): Removed debug
  statments.

7 years agoagenda: Use suspendable ports feature from Guile 2.2.
Christopher Allan Webber [Thu, 8 Dec 2016 18:47:32 +0000 (12:47 -0600)]
agenda: Use suspendable ports feature from Guile 2.2.

This removes the old method of watching for when ports are updated via
select and explicitly calling a particular function, and instead can
simply suspend at the appropriate points using Guile's common I/O
procedures; the agenda handles waking things up when they're ready.

* 8sync/agenda.scm: Import `(ice-9 suspendable-ports)' and run
  install-suspendable-ports!
  (<agenda>, agenda-except-port-map, make-agenda): Drop except-port-map
  from agenda.  The "meaning" of read-port-map and write-port-map has
  changed a bit too; these are still a hash-table of a port to a procedure
  to be called when that port is available, but after being selected,
  items are removed from the table.
  (<port-request>, make-port-request, port-request, <port-remove-request>)
  (port-remove-request, 8sync-port, 8sync-port-remove)
  (agenda-handle-port-request!, agenda-handle-port-remove-request!): Remove.
  (8sync-nowait): Move comment that was previously in 8sync-port here.
  (update-agenda-from-select!): Update to use the new "meaning" of the
  agenda-read-port-map and agenda-write-port-map and to drop referencing
  the deprecated agenda-except-port-map.  Properly removes items from
  the read and write maps once they've been selected.
  (<read-request>, <write-request>, agenda-handle-read-request)
  (agenda-handle-write-request, wait-for-readable, wait-for-writable):
  New variables.
  (stop-on-nothing-to-do): Remove check on removed agenda-except-port-map.
  (agenda-run-once): Parameterize the current-read-waiter and
  current-write-waiter to wait-for-readable and wait-for-writable
  respectively.  Update handle-individual to use the new <read-request>
  and <write-request> types.

7 years agobuild: Require and use guile-2.2.
Christopher Allan Webber [Thu, 8 Dec 2016 18:46:07 +0000 (12:46 -0600)]
build: Require and use guile-2.2.

This is necessary to make use of the suspendable-ports feature.

* configure.ac: Update PKG_CHECK_MODULES to use guile-2.2.
* package.scm: Update package's native-inputs to use guile-next.

7 years agov0.2.0 v0.2.0
Christopher Allan Webber [Mon, 5 Dec 2016 20:15:12 +0000 (14:15 -0600)]
v0.2.0

8 years agoagenda: Add "8sleep" sugar.
Christopher Allan Webber [Tue, 10 May 2016 01:37:15 +0000 (20:37 -0500)]
agenda: Add "8sleep" sugar.

* 8sync/agenda.scm (8sleep): Sugary macro for something like "sleep",
  but tuned to 8sync to be nonblocking.

8 years agoactors: Fix hive-actor-local? to check the hive id, not whether actor exists.
Christopher Allan Webber [Sat, 7 May 2016 17:23:53 +0000 (12:23 -0500)]
actors: Fix hive-actor-local? to check the hive id, not whether actor exists.

* 8sync/systems/actors.scm (hive-actor-local?): Update to check the hive id.

8 years agoagenda: Permit a post-run-hook in start-agenda.
Christopher Allan Webber [Sat, 7 May 2016 17:20:18 +0000 (12:20 -0500)]
agenda: Permit a post-run-hook in start-agenda.

* 8sync/agenda.scm (start-agenda): Add a post-run-hook keyword argument.
  This permits more live hacking madness, as used in syncmud.

8 years agoagenda: Update comment, could also attach catch routines to hive.
Christopher Allan Webber [Tue, 3 May 2016 23:21:04 +0000 (18:21 -0500)]
agenda: Update comment, could also attach catch routines to hive.

* 8sync/systems/actors.scm (hive-process-message): Update comment.

8 years agoactors: Catch all errors in the actor model.
Christopher Allan Webber [Tue, 3 May 2016 23:05:31 +0000 (18:05 -0500)]
actors: Catch all errors in the actor model.

Not doing so results in a SIGABRT.

* 8sync/systems/actors.scm (hive-process-message): Catch all errors
  and call print-error-and-continue.  Leave comment for thoughts on
  using maybe-catch-all.

8 years agoactors: Permit docstrings in mlambda.
Christopher Allan Webber [Tue, 3 May 2016 16:14:28 +0000 (11:14 -0500)]
actors: Permit docstrings in mlambda.

* 8sync/systems/actors.scm (mlambda): Switched to syntax-case so we can
  identify and allow docstrings.

8 years agoactors: Export simple-dispatcher.
Christopher Allan Webber [Tue, 3 May 2016 15:39:36 +0000 (10:39 -0500)]
actors: Export simple-dispatcher.

* 8sync/systems/actors.scm: Export simple-dispatcher.

8 years agoactors: Export build-actions.
Christopher Allan Webber [Tue, 3 May 2016 15:36:58 +0000 (10:36 -0500)]
actors: Export build-actions.

* 8sync/systems/actors.scm: Export build-actions.

8 years agoactors: Add note that maybe action dispatch error checks should be moved.
Christopher Allan Webber [Tue, 3 May 2016 15:31:56 +0000 (10:31 -0500)]
actors: Add note that maybe action dispatch error checks should be moved.

* 8sync/systems/actors.scm (simple-dispatcher): Add comment.

8 years agoactors: Add build-actions and retool make-action-dispatch to use it.
Christopher Allan Webber [Tue, 3 May 2016 15:14:11 +0000 (10:14 -0500)]
actors: Add build-actions and retool make-action-dispatch to use it.

* 8sync/systems/actors.scm (build-actions): New macro.
  (make-action-dispatch): Retool to use build-actions.

8 years agoactors: Add with-message-args and build mlambda off it.
Christopher Allan Webber [Mon, 2 May 2016 15:55:15 +0000 (10:55 -0500)]
actors: Add with-message-args and build mlambda off it.

* 8sync/systems/actors (with-message-args): New macro.
  (mlambda): Retool to use with-message-args as base.

8 years agoactors: Add define-mhandler, a method handler definition tool.
Christopher Allan Webber [Sat, 30 Apr 2016 21:35:51 +0000 (16:35 -0500)]
actors: Add define-mhandler, a method handler definition tool.

* 8sync/systems/actors.scm (define-mhandler): New macro.

8 years agodemos: robotscanner: Use nice auto-message-ref feature.
Christopher Allan Webber [Fri, 29 Apr 2016 21:51:28 +0000 (16:51 -0500)]
demos: robotscanner: Use nice auto-message-ref feature.

* demos/actors/robotscanner.scm (<warehouse-room>, <security-robot>):
  Update to use new automatic-message-ref-pulled-out mlambda syntax.

8 years agodemos: botherbotherbother: Add missing newline.
Christopher Allan Webber [Fri, 29 Apr 2016 21:50:29 +0000 (16:50 -0500)]
demos: botherbotherbother: Add missing newline.

* demos/actors/botherbotherbother.scm (professor-be-bothered):
  Add missing newline.

8 years agoactors: mlambda, removing require-slot, GOOPS usage cleanup
Christopher Allan Webber [Fri, 29 Apr 2016 21:49:05 +0000 (16:49 -0500)]
actors: mlambda, removing require-slot, GOOPS usage cleanup

mlambda is a new nice sugar for passing in arguments, so add that.
Also, various problems found with GOOPS hackery in Guile 2.2.
Cleaning up.

* 8sync/systems/actors.scm (require-slot): Removed.  Doesn't work with
  Guile 2.2.
  (<actor>): Updated to drop usage of require-slot.
  (mlambda): New procedure allowing automatically pulling out message
  stuff from action method definitions.
  (%expand-action-item): Use mlambda.
  (<hive>): Remove redundant slot definition back to hive.  The actor
  already does this, and not re-supplying the accessor breaks GOOPS
  in Guile 2.2.

8 years agoactors: debug: hive-create-actor-gimmie*'s init should glob arguments.
Christopher Allan Webber [Fri, 29 Apr 2016 16:10:27 +0000 (11:10 -0500)]
actors: debug: hive-create-actor-gimmie*'s init should glob arguments.

* 8sync/systems/actors/debug.scm (hive-create-actor-gimmie*): init should
  grab the rest of the arguments.

8 years agoactors: Handle messages/coroutines in want of reply and errors.
Christopher Allan Webber [Wed, 27 Apr 2016 22:08:34 +0000 (17:08 -0500)]
actors: Handle messages/coroutines in want of reply and errors.

If we call another method and we're "waiting" on a reply, and an error
happens in the other function so that it can't continue, that shouldn't
leave our coroutine hanging around in the waiting-coroutines hashmap
forever.  Instead, we raise it and throw an error warning about that.

(More ideally, we'd like to raise this inside of the send-message type
methods but that seems to cause a SIGABRT.  Yikes!)

* 8sync/systems/actors.scm (hive-reply-with-error): New method.
  (hive-process-message): Update call-catching-coroutine to reply with
  an eror if an uncaught exception happens.
  Update resume-waiting-coroutine to recognize whether the message
  has a '*reply* action or not.  If not, remove the coroutine (we'll
  never get a reply) and throw an error.

8 years agoactors: Remove unnecessary let in hive-process-message.
Christopher Allan Webber [Wed, 27 Apr 2016 19:21:59 +0000 (14:21 -0500)]
actors: Remove unnecessary let in hive-process-message.

* 8sync/systems/actors.scm (hive-process-message): Removed unnecessary let.

8 years agodemos: robotscanner: Use new <- syntax.
Christopher Allan Webber [Wed, 27 Apr 2016 18:15:09 +0000 (13:15 -0500)]
demos: robotscanner: Use new <- syntax.

* demos/actors/robotscanner.scm (<overseer>, <warehouse-room>)
  (<droid>, <security-robot>): Update to using <- style send message
  aliases.

8 years agoactors: debug: Fixing hive-create-actor-gimmie, hive-create-actor-gimmie*.
Christopher Allan Webber [Wed, 27 Apr 2016 18:13:03 +0000 (13:13 -0500)]
actors: debug: Fixing hive-create-actor-gimmie, hive-create-actor-gimmie*.

* 8sync/systems/actors/debug.scm (hive-create-actor-gimmie)
  (hive-create-actor-gimmie*): Fix definitions.

8 years agoactors: Define "<-" type aliases for send-message and friends.
Christopher Allan Webber [Wed, 27 Apr 2016 13:24:28 +0000 (08:24 -0500)]
actors: Define "<-" type aliases for send-message and friends.

* 8sync/systems/actors.scm (<-, <-wait, <-reply, <-reply-wait): Aliases
  for send-message, send-message-wait, reply-message, reply-message-wait
  respectively.

8 years agoactors: Rename hive-bootstrap-message -> bootstrap-message.
Christopher Allan Webber [Wed, 27 Apr 2016 12:16:48 +0000 (07:16 -0500)]
actors: Rename hive-bootstrap-message -> bootstrap-message.

* 8sync/systems/actors.scm (bootstrap-message): Renamed from
  hive-bootstrap-message.
* demos/actors/botherbotherbother.scm (main):
* demos/actors/robotscanner.scm (main):
* demos/actors/simplest-possible.scm (main):
* tests/test-actors.scm: Rename references to bootstrap-message.

8 years agoactors: Remove <hive-proxy>; no longer export actor-hive.
Christopher Allan Webber [Wed, 27 Apr 2016 03:34:00 +0000 (22:34 -0500)]
actors: Remove <hive-proxy>; no longer export actor-hive.

The goal of hive-proxy (in XUDD at least) was to prevent actors from
accessing their hive.  Since we're no longer exporting actor-hive
we've more or less achieved that though.

* 8sync/systems/actors.scm: No longer export actor-hive.
  (<message>): Adjust comment about deferred-reply.
  (<hive-proxy>, <debug-hive-proxy>): Removed.

8 years agoactors: debug: Expose more things via debug
Christopher Allan Webber [Wed, 27 Apr 2016 02:35:10 +0000 (21:35 -0500)]
actors: debug: Expose more things via debug

* 8sync/systems/actors/debug.scm (expose): New macro for easy exposing
  of things not normally exported from the actors module.
  (hive-resolve-local-actor): Switch to use "expose".
  (actor-hive): Expose/export.
  (hive-create-actor-gimmie*): Switch to be a procedure rather than a macro.

8 years agodemos: simplest-possible: Rename main function.
Christopher Allan Webber [Tue, 26 Apr 2016 21:27:57 +0000 (16:27 -0500)]
demos: simplest-possible: Rename main function.

* demos/actors/simplest-possible.scm (main): Renamed from run-demo.

8 years agodemos: simplest-possible: Adjust emo/proog dialogue to match film.
Christopher Allan Webber [Tue, 26 Apr 2016 21:23:06 +0000 (16:23 -0500)]
demos: simplest-possible: Adjust emo/proog dialogue to match film.

* 8sync/systems/actors.scm (<emo>, <proog>): Adjust what the characters say.

8 years agoactors: Switch hive-create-actor[*] to match create-actor[*]
Christopher Allan Webber [Tue, 26 Apr 2016 21:07:12 +0000 (16:07 -0500)]
actors: Switch hive-create-actor[*] to match create-actor[*]

* 8sync/systems/actors.scm (hive-create-actor, hive-create-actor*):
  Adjust syntax to match that of create-actor and create-actor*.
* demos/actors/botherbotherbother.scm (main):
* tests/test-actors.scm: Adjust to use.

8 years agoactors: Switch random-number-size to be 2^128.
Christopher Allan Webber [Tue, 26 Apr 2016 20:58:55 +0000 (15:58 -0500)]
actors: Switch random-number-size to be 2^128.

* 8sync/systems/actors.scm (random-number-size): Switch to 2^128.

8 years agodemos: actors: Update main functions to support arbitrary arguments.
Christopher Allan Webber [Tue, 26 Apr 2016 18:39:52 +0000 (13:39 -0500)]
demos: actors: Update main functions to support arbitrary arguments.

* demos/actors/robotscanner.scm (main):
* demos/actors/simplest-possible.scm (run-demo): Update to take
  arbitrary arguments.  This allows being more easily run by the
  command line.

8 years agoactors: Add debug module with useful utilities. wip-actors
Christopher Allan Webber [Tue, 26 Apr 2016 18:30:11 +0000 (13:30 -0500)]
actors: Add debug module with useful utilities.

* 8sync/systems/actors/debug.scm: New file.
* Makefile.am (SOURCES): Add it.

8 years agobuild: Add actors demos to EXTRA_DIST.
Christopher Allan Webber [Tue, 26 Apr 2016 18:29:47 +0000 (13:29 -0500)]
build: Add actors demos to EXTRA_DIST.

* Makefile.am (EXTRA_DIST): Add the actors demos botherbotherbother,
  simplest-possible, and robotscanner.

8 years agoagenda: Update copyright header.
Christopher Allan Webber [Tue, 26 Apr 2016 18:27:46 +0000 (13:27 -0500)]
agenda: Update copyright header.

* 8sync/agenda.scm: Update copyright header.

8 years agodemos: robotscanner: Add comment explaining what the demo does.
Christopher Allan Webber [Tue, 26 Apr 2016 18:27:05 +0000 (13:27 -0500)]
demos: robotscanner: Add comment explaining what the demo does.

* demos/actors/robotscanner.scm: New toplevel comment.

8 years agodemos: actors: Adding new robotscanner demo.
Christopher Allan Webber [Tue, 26 Apr 2016 18:24:12 +0000 (13:24 -0500)]
demos: actors: Adding new robotscanner demo.

* 8sync/actors/robotscanner.scm: New file.

8 years agoactors: Switch send-message and reply-message to use 8sync-nowait
Christopher Allan Webber [Tue, 26 Apr 2016 17:52:28 +0000 (12:52 -0500)]
actors: Switch send-message and reply-message to use 8sync-nowait

There's no reason to block on continuing our work if using just
send-message and reply-message, so, fix.

* 8sync/systems/actors.scm (send-message, reply-message):
  Switch to using 8sync-nowait instead of 8sync.

8 years agoagenda: Rename 8sync-immediate to 8sync-nowait and fix.
Christopher Allan Webber [Tue, 26 Apr 2016 17:51:08 +0000 (12:51 -0500)]
agenda: Rename 8sync-immediate to 8sync-nowait and fix.

* 8sync/agenda.scm (8sync-nowait): Rename from 8sync-immediate.
  Fix so that it runs (needed to put body in lambda)

8 years agoactors: Fix self-destruct.
Christopher Allan Webber [Tue, 26 Apr 2016 15:46:21 +0000 (10:46 -0500)]
actors: Fix self-destruct.

* 8sync/systems/actors.scm (self-destruct): Fix call to hash-remove!,
  which had the wrong arguments passed to hash-remove!

8 years agoactors: Fix create-actor, create-actor*
Christopher Allan Webber [Tue, 26 Apr 2016 15:11:05 +0000 (10:11 -0500)]
actors: Fix create-actor, create-actor*

* 8sync/systems/actors.scm (create-actor, create-actor*):
  Fixed calls to %hive-create-actor, which were missing the actor class.

8 years agoactors: Add actor creation/destruction methods.
Christopher Allan Webber [Tue, 26 Apr 2016 15:07:52 +0000 (10:07 -0500)]
actors: Add actor creation/destruction methods.

* 8sync/systems/actors.scm (create-actor, create-actor*, self-destruct):
  New procedures.

8 years agotests: actors: Add autoreply tests.
Christopher Allan Webber [Mon, 25 Apr 2016 19:21:00 +0000 (14:21 -0500)]
tests: actors: Add autoreply tests.

* tests/test-actors.scm: Added autoreply tests.
  (%record-out, ~display, ~format): Tools to test the display output
  from tests.
  (<antsy-caller>, <diligent-rep>, <lazy-rep>): New classes for testing
  autoreply tools.

8 years agoactors: Properly autoreply to replies; make reply-message-wait work.
Christopher Allan Webber [Mon, 25 Apr 2016 18:47:29 +0000 (13:47 -0500)]
actors: Properly autoreply to replies; make reply-message-wait work.

* 8sync/systems/actors.scm (hive-process-message): Enable prompt even when
  resuming coroutines.
  Enable autoreply when resuming coroutines.
  (send-message-wait, reply-message-wait): Rename agenda-prompt variable to
  abort-to, which makes more sense.

8 years agoactors: Remove unnecessary "begin".
Christopher Allan Webber [Mon, 25 Apr 2016 18:15:04 +0000 (13:15 -0500)]
actors: Remove unnecessary "begin".

* 8sync/systems/actors.scm (hive-process-message): Remove "begin",
  which was only wrapping one thing.

8 years agoactors: Add autoreply support.
Christopher Allan Webber [Mon, 25 Apr 2016 18:12:11 +0000 (13:12 -0500)]
actors: Add autoreply support.

* 8sync/systems/actors.scm (message-needs-reply): New method.
  (hive-process-message): Add autoreply to process-local-message logic.
  Add comment about maybe clearing out old coroutines.

8 years agoactors: Fix resuming continuation when waiting on message.
Christopher Allan Webber [Mon, 25 Apr 2016 17:51:09 +0000 (12:51 -0500)]
actors: Fix resuming continuation when waiting on message.

Pattern matching was wrong.  Also added an error check.

* 8sync/systems/actors.scm (hive-process-message): Fix pattern match.
  Add error check that we're resuming to the correct actor.

8 years agoactors: Remove nesting of actions in define-simple-actor.
Christopher Allan Webber [Mon, 25 Apr 2016 16:59:31 +0000 (11:59 -0500)]
actors: Remove nesting of actions in define-simple-actor.

* 8sync/systems/actors.scm (define-simple-actor): Move actions out of
  the "final parenthesis".  Simple actors just have a class type and
  then the rest of the arguments are acitons.
* demos/actors/simplest-possible.scm: Remove unnecessary import
  of (ice-9 match).
  (<emo>, <proog>): Adjust to new syntax for define-simple-actor.

8 years agotests: test-agenda: Remove broken shebang.
Christopher Allan Webber [Mon, 25 Apr 2016 16:48:28 +0000 (11:48 -0500)]
tests: test-agenda: Remove broken shebang.

* tests/test-agenda.scm: Removed broken shebang.

8 years agotests: test-actors: Add copyright header.
Christopher Allan Webber [Mon, 25 Apr 2016 16:47:53 +0000 (11:47 -0500)]
tests: test-actors: Add copyright header.

* tests/test-actors.scm: Add copyright header.

8 years agodemos: botherbotherbother: Make executable from command line.
Christopher Allan Webber [Mon, 25 Apr 2016 16:44:55 +0000 (11:44 -0500)]
demos: botherbotherbother: Make executable from command line.

* demos/actors/botherbotherbother.scm: Make executable.
  Add shebang.
  (main): Allow arbitrary arguments from the command line or wherever.

8 years agoactors; Move message definitions earlier in the file.
Christopher Allan Webber [Mon, 25 Apr 2016 16:39:13 +0000 (11:39 -0500)]
actors; Move message definitions earlier in the file.

The original positioning would mean that sometimes the accessors would
break in some of the actor/hive methods.  Defining the messages before
any methods make use of them seems to fix the problem.

* 8sync/systems/actors.scm (<message>, message?, make-message-intern)
  (message-id, message-to message-from, message-action, message-body)
  (message-in-reply-to, message-replied, set-message-replied!)
  (message-deferred-reply, set-message-deferred-reply!, make-message)
  (%nothing-provided, message-ref, kwarg-list-to-alist, send-message)
  (send-message-wait, reply-message, reply-message-wait):
  Moved location to earlier in file.

8 years agotests: actors: Fix test-end in test-actors.scm.
Christopher Allan Webber [Mon, 25 Apr 2016 14:43:14 +0000 (09:43 -0500)]
tests: actors: Fix test-end in test-actors.scm.

* tests/test-actors.scm: Fix test-end, which previously pointed at test-agenda.

8 years agobuild: Add actors.scm to SOURCES
Christopher Allan Webber [Sat, 23 Apr 2016 15:57:45 +0000 (10:57 -0500)]
build: Add actors.scm to SOURCES

* Makefile.am (SOURCES): Add 8sync/systems/actors.scm.

8 years agobuild: Add test-actors.scm to tests.
Christopher Allan Webber [Fri, 22 Apr 2016 19:04:13 +0000 (14:04 -0500)]
build: Add test-actors.scm to tests.

* Makefile.am (TESTS): Add tests/test-actors.scm.

8 years agotests: actors: Test serialization / deserialization of messages
Christopher Allan Webber [Fri, 22 Apr 2016 19:03:18 +0000 (14:03 -0500)]
tests: actors: Test serialization / deserialization of messages

* tests/test-actors.scm: Add message write/read tests.

8 years agoactors: Switch comment header
Christopher Allan Webber [Fri, 22 Apr 2016 16:19:03 +0000 (11:19 -0500)]
actors: Switch comment header

* 8sync/systems/actors: Switch "Convenience procedures" comment header
  to "Basic readers / writers".

8 years agoactors: Fix serialize-message to not use address->string
Christopher Allan Webber [Fri, 22 Apr 2016 15:46:58 +0000 (10:46 -0500)]
actors: Fix serialize-message to not use address->string

If we use address->string, read/write are no longer symmetric.

* 8sync/systems/actors.scm (serialize-message): Switch address
  serialization to not use address->string.

8 years agoactors: Fix export of pprint-message
Christopher Allan Webber [Fri, 22 Apr 2016 15:42:34 +0000 (10:42 -0500)]
actors: Fix export of pprint-message

* 8sync/systems/actors.scm: Fix export.  Previously said pprint-mesage.

8 years agotests: actors: Fix check for a missing key on message-ref
Christopher Allan Webber [Fri, 22 Apr 2016 15:36:03 +0000 (10:36 -0500)]
tests: actors: Fix check for a missing key on message-ref

* tests/test-actors.scm: Update test for message-ref with missing key.
  It used to be that the default was to return #f.
  Now the default is to throw an error if no default provided.

8 years agoactors: message-ref: Throw a better error on missing key
Christopher Allan Webber [Fri, 22 Apr 2016 15:31:25 +0000 (10:31 -0500)]
actors: message-ref: Throw a better error on missing key

* 8sync/systems/actors (message-ref): Throw 'message-missing-key
  on errors now.

8 years agoactors: Export read/write methods on messages.
Christopher Allan Webber [Fri, 22 Apr 2016 15:26:03 +0000 (10:26 -0500)]
actors: Export read/write methods on messages.

* 8sync/systems/actors.scm (serialize-message, write-message)
  (serialize-message-pretty pprint-mesage read-message)
  (read-message-from-string): Export methods.

8 years agoactors: `message-ref' now errors if no dflt provided and key not found
Christopher Allan Webber [Fri, 22 Apr 2016 15:10:27 +0000 (10:10 -0500)]
actors: `message-ref' now errors if no dflt provided and key not found

Thanks to David Thompson for guidance on the best way to construct
%nothing-provided.

* 8sync/systems/actors.scm (message-ref): Adjust to error if no dflt
  provided and key isn't found.
  (%nothing-provided): New unique, immutable value for checking
  if dflt provided to message-ref.

8 years agoactors: New read-message procedures, touch up write-message procedures
Christopher Allan Webber [Fri, 22 Apr 2016 15:03:08 +0000 (10:03 -0500)]
actors: New read-message procedures, touch up write-message procedures

* 8sync/systems/actors.scm (read-message, read-message-from-string):
  New procedures for reading in a serialized message.
  (write-message): Supply a default port (current-output-port) if none
  is provided.
  (serialize-message, serialize-message-pretty): Write out message-wants-reply,
  which we accidentally left out earlier.

8 years agoactors: Switch out address objects for more-easily-serialized cons cells
Christopher Allan Webber [Fri, 22 Apr 2016 14:34:57 +0000 (09:34 -0500)]
actors: Switch out address objects for more-easily-serialized cons cells

This is maybe temporary.  If we ever have canonical sexps as the
general serialization format, or something like that, we might revert
to a nicer structure.

* 8sync/systems/actors.scm (<address>): Commented out.

8 years agoactors: Added docstrings to some message write procedures
Christopher Allan Webber [Fri, 22 Apr 2016 14:24:44 +0000 (09:24 -0500)]
actors: Added docstrings to some message write procedures

* 8sync/systems/actors.scm (write-message, serialize-message-pretty)
  (pprint-message): Add docstrings.

8 years agoactors: Write/pretty-print procedures for messages
Christopher Allan Webber [Fri, 22 Apr 2016 14:17:44 +0000 (09:17 -0500)]
actors: Write/pretty-print procedures for messages

* 8sync/systems/actors.scm (serialize-message, write-message):
  New procedures for writing out messages.
  (serialize-message-pretty, pprint-message): New procedures
  for pretty printing.
  (<address>): Update printer to look a little bit nicer.

8 years agoactors: Rename function deferred-reply -> message-deferred-reply
Christopher Allan Webber [Fri, 22 Apr 2016 13:47:59 +0000 (08:47 -0500)]
actors: Rename function deferred-reply -> message-deferred-reply

* 8sync/systems/actors.scm (deferred-reply, message-deferred-reply):
  Renamed former to latter.

8 years agotests: test-actors: Start testing the actor model
Christopher Allan Webber [Fri, 22 Apr 2016 03:46:59 +0000 (22:46 -0500)]
tests: test-actors: Start testing the actor model

There's not much here yet.

* tests/test-actors.scm: New file.

8 years agodemos: actors: A couple of simple actor model demos.
Christopher Allan Webber [Fri, 22 Apr 2016 03:44:47 +0000 (22:44 -0500)]
demos: actors: A couple of simple actor model demos.

* demos/actors/simplest-possible.scm: New file.
  Simplest possible demo: Two actors say hello to each other.
* demos/actors/botherbotherbother.scm: New file.
  A little bit more complex; multiple actors interact with each
  other.  Ensures that actors don't clobber each other unexpectedly.

8 years agosystems: actors: New actor model system.
Christopher Allan Webber [Sat, 16 Apr 2016 22:17:28 +0000 (17:17 -0500)]
systems: actors: New actor model system.

* 8sync/systems/actors.scm: New file, containing actor model system.

8 years agoagenda: Make agendas run with "easier" default arguments
Christopher Allan Webber [Sun, 24 Apr 2016 19:18:56 +0000 (14:18 -0500)]
agenda: Make agendas run with "easier" default arguments

* 8sync/agenda.scm (make-agenda): Set #:pre-unwind-handler to
  print-error-and-continue.  This makes it so that by default,
  exceptions get printed to the shell in which the agenda was spawned.
  (start-agenda): Set #:stop-condition to stop-on-nothing-to-do.  This
  is a bit heavier than maybe desirable but is a good "default" stop
  condition, and prevents the agenda from entering into a busy-loop
  when computation has finished.

8 years agobuild: Ignore .sig, .directive, .asc files.
Christopher Allan Webber [Fri, 22 Apr 2016 22:13:25 +0000 (17:13 -0500)]
build: Ignore .sig, .directive, .asc files.

* .gitignore: Add ignore rules for .sig, .directive, .asc files.

8 years agobuild: Bump version number. v0.1.0
Christopher Allan Webber [Fri, 22 Apr 2016 19:34:13 +0000 (14:34 -0500)]
build: Bump version number.

* configure.ac: Change version to 0.1.0.

8 years agoREADME: Mention COPYING
Christopher Allan Webber [Fri, 22 Apr 2016 19:31:47 +0000 (14:31 -0500)]
README: Mention COPYING

* README: Mention COPYING file.

8 years agoMention INSTALL in the README file.
Christopher Allan Webber [Fri, 15 Apr 2016 18:15:25 +0000 (13:15 -0500)]
Mention INSTALL in the README file.

* README: Mention INSTALL file.

8 years agoAdd generic GNU style INSTALL file
Christopher Allan Webber [Fri, 15 Apr 2016 18:14:48 +0000 (13:14 -0500)]
Add generic GNU style INSTALL file

* INSTALL: New file.

8 years agoMove README.md to README
Christopher Allan Webber [Fri, 15 Apr 2016 18:14:14 +0000 (13:14 -0500)]
Move README.md to README

* README: Renamed from README.md.

8 years agobuild: Add COPYING-gplv3 to EXTRA_DIST
Christopher Allan Webber [Fri, 15 Apr 2016 18:09:16 +0000 (13:09 -0500)]
build: Add COPYING-gplv3 to EXTRA_DIST

* Makefile.am (EXTRA_DIST): add COPYING-GPLv3.txt

8 years agoUpdate %8sync -> 8sync in NEWS and README.md
Christopher Allan Webber [Fri, 15 Apr 2016 15:20:33 +0000 (10:20 -0500)]
Update %8sync -> 8sync in NEWS and README.md

* NEWS:
* README.md: Update references from %8sync -> 8sync.

8 years agoagenda: Rename %8sync (and %8sync-*) to 8sync (and 8sync-*)
Christopher Allan Webber [Fri, 15 Apr 2016 15:05:02 +0000 (10:05 -0500)]
agenda: Rename %8sync (and %8sync-*) to 8sync (and 8sync-*)

* 8sync/agenda.scm (%8sync, %8sync-delay, %8sync-run, %8sync-run-at)
  (%8sync-run-delay, %8sync-port, %8sync-port-remove, catch-%8sync):
  Rename, removing % sign.  Rename all references to other %8sync-foo
  in definitions and comments as well.
  (catch-8sync): Removed aliased version.
  (make-async-request, setup-async-request): Rename references of
  %8sync-foo to 8sync-foo.

* 8sync/systems/irc.scm (make-basic-irc-handler):
* 8sync/systems/web.scm (receive-http-conn):
* tests/test-agenda.scm: Rename all %8sync-foo to 8sync-foo.

8 years agosystems: web: Re-enable co-op repl with simple http server
Christopher Allan Webber [Thu, 14 Apr 2016 22:03:53 +0000 (17:03 -0500)]
systems: web: Re-enable co-op repl with simple http server

* 8sync/systems/web.scm (run-simple-webserver): Uncomment enabling
  the coop-repl.

8 years agodoc: Add scaffolding for new chapters
Christopher Allan Webber [Sat, 9 Apr 2016 18:48:49 +0000 (13:48 -0500)]
doc: Add scaffolding for new chapters

* doc/8sync.texi (Installation, Getting started, API Reference, Contributing):
  New chapter scaffolding added.

8 years agoAdd guix package.
Jan Nieuwenhuizen [Tue, 1 Mar 2016 07:10:59 +0000 (08:10 +0100)]
Add guix package.

* package.scm: New file.