8sync.git
7 years agoagenda: Remove deprecated comment.
Christopher Allan Webber [Fri, 6 Jan 2017 17:29:27 +0000 (11:29 -0600)]
agenda: Remove deprecated comment.

* 8sync/agenda.scm (run-agenda): Remove comment, since we did the thing
it suggested doing in the future.

7 years agodoc: Some tutorial tweaks.
Christopher Allan Webber [Fri, 6 Jan 2017 16:11:54 +0000 (10:11 -0600)]
doc: Some tutorial tweaks.

* doc/8sync-new-manual.org: Small tutorial tweaks.

7 years agodoc: Move the "live hacking intermission" to the bottom.
Christopher Allan Webber [Thu, 5 Jan 2017 03:38:23 +0000 (21:38 -0600)]
doc: Move the "live hacking intermission" to the bottom.

* doc/8sync-new-manual.org: Move the "live hacking intermission" to
the bottom of the tutorial.

7 years agodoc: Tutorial additions.
Christopher Allan Webber [Thu, 5 Jan 2017 03:36:31 +0000 (21:36 -0600)]
doc: Tutorial additions.

* doc/8sync-new-manual.org: Add "Writing our own network-enabled
actor" section.  Clean up other sections, including moving the intro
to the tutorial blathering about IRC systems to a footnote.

7 years agoUse *init* and *cleanup* in existing actors.
Christopher Allan Webber [Thu, 5 Jan 2017 02:02:13 +0000 (20:02 -0600)]
Use *init* and *cleanup* in existing actors.

* 8sync/repl.scm (<repl-manager>):
* 8sync/systems/irc.scm (<irc-bot>): Switch from an 'init action to the
implicit '*init* action.

* 8sync/systems/irc.scm (<irc-bot>, irc-bot-cleanup): Add *cleanup*
handler.

* demos/ircbot.scm:
* doc/8sync-new-manual.org: Drop some calls to 'init when
bootstrapping-messages since we now use '*init*.

7 years agodemos: Switch botherbotherbother demo over to use define-actor.
Christopher Allan Webber [Wed, 4 Jan 2017 22:53:55 +0000 (16:53 -0600)]
demos: Switch botherbotherbother demo over to use define-actor.

* demos/actors/botherbotherbother.scm: Switch to use define-actor.

7 years agoactors: Cleanup on signals.
Christopher Allan Webber [Wed, 4 Jan 2017 20:12:15 +0000 (14:12 -0600)]
actors: Cleanup on signals.

* 8sync/actors.scm (run-hive): Handle signals, currently SIGINT and
SIGTERM, in a friendly way.  Will still run cleanup on actors.

7 years agoactors: Remove define-simple-actor, add define-actor.
Christopher Allan Webber [Wed, 4 Jan 2017 17:41:30 +0000 (11:41 -0600)]
actors: Remove define-simple-actor, add define-actor.

define-simple-actor wasn't very useful, whereas define-actor is
moderately helpful.

* 8sync/actors.scm (define-simple-actor): Remove.
(define-actor): New macro.

* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* tests/test-actors.scm: Convert to use define-simple-actor instead of
define-actor.

7 years agodoc: Add a note about the calls to display.
Christopher Allan Webber [Wed, 4 Jan 2017 17:41:22 +0000 (11:41 -0600)]
doc: Add a note about the calls to display.

* doc/8sync-new-manual.org: Add paragraph.

7 years agodoc: Tweak and fix the "Writing our own actors" section.
Christopher Allan Webber [Wed, 4 Jan 2017 17:31:57 +0000 (11:31 -0600)]
doc: Tweak and fix the "Writing our own actors" section.

* doc/8sync-new-manual.org: Fixed some errors and made things a bit
clearer.

7 years agoactors: Rename msg-receive, msg-val to mbody-receive, mbody-val.
Christopher Allan Webber [Wed, 4 Jan 2017 16:28:18 +0000 (10:28 -0600)]
actors: Rename msg-receive, msg-val to mbody-receive, mbody-val.

* 8sync/actors.scm (mbody-receive, mbody-val): Rename from msg-receive,
msg-val.  Update all callers.

7 years agoactors: Add auto-init feature to actors.
Christopher Allan Webber [Wed, 4 Jan 2017 01:57:50 +0000 (19:57 -0600)]
actors: Add auto-init feature to actors.

* 8sync/actors.scm (<actor>): Add '*init* action to actions slot.
(<hive>, hive-handle-init-all): Add '*init-all* action.
(hive-handle-cleanup-all): Adjust comment.
(%hive-create-actor): Add send-init? argument, and when supplied
call <-wait on the actor's '*init* method.
(bootstrap-actor, bootstrap-actor*): Rename from hive-create-actor,
hive-create-actor*.  Switch init argument to init-args and pass in #f to
%hive-create-actor's send-init? argument.
(create-actor, create-actor*): Switch init argument to init-args
and pass in #t to %hive-create-actor's send-init? argument.
(run-hive): Add '*init-all* action call to the hive on the initial
queue.

* 8sync/debug.scm (bootstrap-actor-gimmie, bootstrap-actor-gimmie*):
Rename from hive-create-actor-gimmie, hive-create-actor-gimmie*.

* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* demos/ircbot.scm:
* doc/8sync-new-manual.org:
* tests/test-actors.scm: Change calls from hive-create-actor to
bootstrap-actor.

* tests/test-actors.scm: Add actor *init*'ing tests.

7 years agodoc: Add addendum section on relationship between 8sync and Fibers.
Christopher Allan Webber [Tue, 3 Jan 2017 17:48:28 +0000 (11:48 -0600)]
doc: Add addendum section on relationship between 8sync and Fibers.

* doc/8sync-new-manual.org: Add "8sync and Fibers" section.

7 years agoactors: Implicit from-actor argument <-foo methods, and add rest of <-foo*.
Christopher Allan Webber [Tue, 3 Jan 2017 01:20:58 +0000 (19:20 -0600)]
actors: Implicit from-actor argument <-foo methods, and add rest of <-foo*.

* 8sync/actors.scm (<-, <-wait, <-reply, <-reply-wait): from-actor is
now implicitly supplied via %current-actor parameter.
(<-*, <-reply*): New procedures.
(<-wait*, <-reply-wait*): Now pull from-actor from #:actor.

* 8sync/actors.scm:
* 8sync/systems/irc.scm:
* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* demos/ircbot.scm:
* tests/test-actors.scm: Update all callers of <-foo procedures to drop
from-actor argument.

* doc/8sync-new-manual.org: Update documentation of <-foo procedures to
drop from-actor argument.

7 years agoagenda: Rename start-agenda to run-agenda.
Christopher Allan Webber [Mon, 2 Jan 2017 22:33:10 +0000 (16:33 -0600)]
agenda: Rename start-agenda to run-agenda.

* 8sync/agenda.scm (run-agenda): Renamed from start-agenda.
* 8sync/actors.scm:
* tests/test-agenda.scm: Update all callers.

7 years agoactors: Rename *clean-up* back to *cleanup.
Christopher Allan Webber [Mon, 2 Jan 2017 21:38:23 +0000 (15:38 -0600)]
actors: Rename *clean-up* back to *cleanup.

By popular intarwebs opinion.

* 8sync/actors.scm (<actor>, <hive>, hive-handle-cleanup-all)
(self-destruct, run-hive): Rename all references of clean-up to cleanup.
(hive-handle-cleanup-all, run-hive-cleanup): Rename name from clean-up
version.
* tests/test-actors.scm: Likewise.

7 years agoactors: Rename actor-am-i-alive? to actor-alive?.
Christopher Allan Webber [Mon, 2 Jan 2017 21:15:59 +0000 (15:15 -0600)]
actors: Rename actor-am-i-alive? to actor-alive?.

* 8sync/actors.scm (actor-alive?): Rename from actor-am-i-alive?.
* 8sync/actors.scm:
* 8sync/repl.scm:
* doc/8sync-new-manual.org: Update all references to actor-alive?.

7 years agoactors: Automatically add cookie by default in hive-create-actor.
Christopher Allan Webber [Mon, 2 Jan 2017 21:15:29 +0000 (15:15 -0600)]
actors: Automatically add cookie by default in hive-create-actor.

Also switch separator in cookie from "-" to ":".

* 8sync/actors.scm (hive-gen-actor-id): Switch separator from "-" to ":".
(hive-create-actor): Automatically add a cookie based on the class name.
(hive-create-actor*): Tweak docstring.

7 years agotests: Fix broken test in test-actors.
Christopher Allan Webber [Mon, 2 Jan 2017 18:23:52 +0000 (12:23 -0600)]
tests: Fix broken test in test-actors.

* tests/test-actors.scm: Fix broken test, forgot to update expected output.

7 years agotests: Oops, forgot to add <exploder> to test-actors.
Christopher Allan Webber [Mon, 2 Jan 2017 18:21:23 +0000 (12:21 -0600)]
tests: Oops, forgot to add <exploder> to test-actors.

* tests/test-actors.scm: Add <exploder>.

7 years agoactors: Update self-destruct to run *clean-up* message handler.
Christopher Allan Webber [Mon, 2 Jan 2017 18:17:15 +0000 (12:17 -0600)]
actors: Update self-destruct to run *clean-up* message handler.

* 8sync/actors.scm (self-destruct): Wait on *clean-up* action before
self-destructing by default.
(run-hive): Add parameter to specify whether or not to clean-up after
the hive finishes its tasks.
* tests/test-actors.scm: Add tests for disabling #:clean-up on run-tasks
and ensuring that *clean-up* runs on self-destruct.

7 years agoactors: Rename *cleanup* action to *clean-up*.
Christopher Allan Webber [Mon, 2 Jan 2017 17:54:03 +0000 (11:54 -0600)]
actors: Rename *cleanup* action to *clean-up*.

* 8sync/actors.scm (<actor>, <hive>, hive-handle-clean-up-all, run-hive):
Rename *cleanup* to *clean-up* and *cleanup-all* to *clean-up-all*.
* tests/test-actors.scm: Likewise.

7 years agoactors: Add cleanup facility to run-hive.
Christopher Allan Webber [Mon, 2 Jan 2017 17:40:42 +0000 (11:40 -0600)]
actors: Add cleanup facility to run-hive.

* 8sync/actors.scm (build-actions): Moved location to be before <actor>
for compiler reasons.
(<actor>): Add *cleanup* default action to all actors, which does
nothing by default.
(<hive>, hive-handle-cleanup-all): New cleanup method, which gives
all actors still in the registry a chance to clean up.
(make-hive): Have the hive register itself to itself.
(run-hive): Now run in a dynamic-wind, and call run-hive-cleanup when
we're done.
(run-hive-cleanup): New variable.

* tests/test-actors.scm: New test to make sure cleanup is run.

7 years agotests: Add "speaker" utility.
Christopher Allan Webber [Mon, 2 Jan 2017 17:34:13 +0000 (11:34 -0600)]
tests: Add "speaker" utility.

* tests/utils.scm (speak-it, %speaker, speak, get-spoken, with-fresh-speaker):
New variables.
* tests/test-agenda.scm (speak-it): Remove in favor of new speaker from
utils.scm.  Update to use new speaker.

7 years agodoc: Rename calls to ez-run-hive to run-hive and adjust titles.
Christopher Allan Webber [Mon, 2 Jan 2017 00:46:08 +0000 (18:46 -0600)]
doc: Rename calls to ez-run-hive to run-hive and adjust titles.

* doc/8sync-new-manual.org: Rename calls to ez-run-hive to run-hive and
adjust titles.

7 years agoactors: Rename ez-run-hive to run-hive.
Christopher Allan Webber [Mon, 2 Jan 2017 00:45:50 +0000 (18:45 -0600)]
actors: Rename ez-run-hive to run-hive.

* 8sync/actors.scm (run-hive): Renamed from ez-run-hive.
All callers changed.

7 years agodocs: Added "Writing our own actors" section
Christopher Allan Webber [Sun, 1 Jan 2017 14:57:01 +0000 (08:57 -0600)]
docs: Added "Writing our own actors" section

* doc/8sync-new-manual.org: New "Writing our own actors and sending
messages between them" section.

7 years agodoc: Add pk debugging section.
Christopher Allan Webber [Sat, 31 Dec 2016 15:48:36 +0000 (09:48 -0600)]
doc: Add pk debugging section.

* doc/8sync-new-manual.org: Add pk debugging section.
Simplify some handle-line examples.

7 years agodoc: Finish "About live hacking" section.
Christopher Allan Webber [Fri, 30 Dec 2016 15:22:41 +0000 (09:22 -0600)]
doc: Finish "About live hacking" section.

* doc/8sync-new-manual.org: "An intermission: about live hacking" section
finished, at least for now.

7 years agoagenda: When re-invoking a continuation at the agenda, don't wrap in a catch.
Christopher Allan Webber [Wed, 28 Dec 2016 17:49:05 +0000 (11:49 -0600)]
agenda: When re-invoking a continuation at the agenda, don't wrap in a catch.

* 8sync/agenda.scm (<kontinue>): Add new record type which just wraps a
delimited continuation.
(8sync, 8sleep, 8yield): Wrap continuations in kontinue.
(agenda-run-once!): If "kontinue?", just resume the continuation without
catching errors (it already has an error handler!).

7 years agoagenda: Fix prompt buildup in agenda.
Christopher Allan Webber [Wed, 28 Dec 2016 16:33:19 +0000 (10:33 -0600)]
agenda: Fix prompt buildup in agenda.

Every time a delimited continuation was resumed, we were re-parameterizing.

* 8sync/agenda.scm (current-agenda-prompt): Remove.
(8sync-abort-to-prompt): Use (%current-agenda-prompt) parameter.
(%current-agenda-prompt): New prompt, deprecating %current-agenda.  This
is a slight optimization; we were only using the agenda for the prompt,
so we can remove the indirection of looking up the agenda prompt tag
every time.
(%current-agenda): Removed, see above.
(start-agenda): Move parameterization of %current-agenda-prompt,
current-read-waiter, and current-write-waiter here.
(agenda-run-once!): Remove parameterization.
Also remove comment which is irrelevant now that we're no longer using
an immutable-record-type on the agenda.

7 years agoagenda: Switch "yield" to "8yield" and export.
Christopher Allan Webber [Wed, 28 Dec 2016 16:29:58 +0000 (10:29 -0600)]
agenda: Switch "yield" to "8yield" and export.

This avoids a name collision with an existing procedure.  Plus yield was
never exported, apparently.

* 8sync/agenda.scm (8yield): Renamed from yield.

7 years agoagenda: Major cleanup.
Christopher Allan Webber [Tue, 27 Dec 2016 20:17:42 +0000 (14:17 -0600)]
agenda: Major cleanup.

* 8sync/agenda.scm (<agenda>, make-agenda, agenda-time): Move from being
an immutable-record-type to just a regular one.  Add set-agenda-queue!
and remove time slot.
(time-from-float-or-fraction, time-segment-right-format, <time-delta>)
(make-time-delta, tdelta, time-delta+, 8usleep): Removed.
(schedule-add!, schedule-segments-split): Remove let shadowing of time.
There's no need to always convert the time format since it should now be
correct by the time it gets here.
(delayed-time): New variable.
(run-delay, 8sleep): Use delayed-time.
(update-agenda-from-select!): Use gettimeofday instead of agenda-time.
(start-agenda): Remove get-time and handle-ports keyword arguments.
Simplify loop considerably.
(agenda-run-once!): Renamed from agenda-run-once.  Simplify the enqueue
part of the code since we've constrained what an acceptable time value
looks like.  Use set-agenda-queue!.

* tests/test-agenda: Update for changes to agenda.scm.

7 years agoactors: Add new method of running REPL via REPL actor.
Christopher Allan Webber [Tue, 27 Dec 2016 02:13:23 +0000 (20:13 -0600)]
actors: Add new method of running REPL via REPL actor.

Also adds new procedure to see if an actor is alive, and make use of it
in the new REPL actor.

* 8sync/actors.scm (actor-am-i-alive?): New procedure.
(ez-run-hive): Remove #:repl-server keyword.
* 8sync/repl.scm (<make-coop-server-handler, spawn-and-queue-repl-server!):
Remove.
(<repl-manager>, repl-manager-cleanup, repl-manager-init): New variables.
* demos/ircbot.scm (parse-args): Add --repl command line option.
(run-bot): Add and queue <repl-manager> actor if appropriate.

7 years agoactors: Removing unnecessary level of indirection around actor-message-handler.
Christopher Allan Webber [Mon, 26 Dec 2016 21:26:10 +0000 (15:26 -0600)]
actors: Removing unnecessary level of indirection around actor-message-handler.

* 8sync/actors.scm (actor-message-handler): Move to be a simple #:getter
of <actor>, which is what it really was already anyhow.

7 years agodoc: Add "A silly little IRC bot" section to new manual.
Christopher Allan Webber [Sun, 25 Dec 2016 15:31:45 +0000 (09:31 -0600)]
doc: Add "A silly little IRC bot" section to new manual.

* doc/8sync-new-manual.org: Add "A silly little IRC bot" section.

7 years agodemos: Import format in ircbot.scm.
Christopher Allan Webber [Sun, 25 Dec 2016 15:21:44 +0000 (09:21 -0600)]
demos: Import format in ircbot.scm.

* demos/ircbot.scm: Import "(ice-9 format)".

7 years agodoc: Add tutorial intro to the new manual.
Christopher Allan Webber [Sun, 25 Dec 2016 04:59:29 +0000 (22:59 -0600)]
doc: Add tutorial intro to the new manual.

* doc/8sync-new-manual.org: Fill in "Intro to the tutorial" section.

7 years agodoc: Drafting a new manual.
Christopher Allan Webber [Sat, 24 Dec 2016 19:55:47 +0000 (13:55 -0600)]
doc: Drafting a new manual.

* doc/8sync-new-manual.org: New file.  This is a temporary location for
manual contents while ideas for the manual are being spelled out.

7 years agoirc: Split irc-bot-send-line into main functionality and action handler.
Christopher Allan Webber [Sat, 24 Dec 2016 19:09:54 +0000 (13:09 -0600)]
irc: Split irc-bot-send-line into main functionality and action handler.

This allows irc-bot-send-line to be called directly.

* 8sync/systems/irc.scm (irc-bot-send-line): Update this procedure to
not have a message as one of the arguments so it can be called directly.
(irc-bot-send-line-action): Action handler, doing what irc-bot-send-line
previously did.
(<irc-bot>): Update actions mapping to point to irc-bot-send-line-action.

7 years agoactors: Update actor ids to use a vector rather than a cons cell.
Christopher Allan Webber [Sat, 24 Dec 2016 19:06:12 +0000 (13:06 -0600)]
actors: Update actor ids to use a vector rather than a cons cell.

This is a bit easier to read when read/written, and should be
comparatively efficient.

* 8sync/actors.scm (make-address, address-actor-id, address-hive-id):
Update to use a vector rather than a cons cell.

7 years agoirc: Fixing "PONG" response, calls to handle-foo commands.
Christopher Allan Webber [Sat, 24 Dec 2016 17:58:37 +0000 (11:58 -0600)]
irc: Fixing "PONG" response, calls to handle-foo commands.

* 8sync/systems/irc.scm (dispatch-raw-line): Append irc-eol to PONG response.
Fix calls to hanle-line and handle-misc-input, which recently were
renamed.

7 years agoirc: Shorten generic method names.
Christopher Allan Webber [Fri, 23 Dec 2016 21:19:08 +0000 (15:19 -0600)]
irc: Shorten generic method names.

* 8sync/systems/irc.scm: (handle-line, handle-misc-input)
(handle-user-join, handle-user-quit): Shorten names from their previous
irc-bot-* longer names.  Update callers.
* demos/ircbot.scm: Update callers to above.

7 years agoirc: Move irc-bot code to make use of generic methods
Christopher Allan Webber [Fri, 23 Dec 2016 20:22:28 +0000 (14:22 -0600)]
irc: Move irc-bot code to make use of generic methods

ircbot.scm demo also now makes use of subclassing.

* 8sync/systems/irc.scm (<irc-bot>): Removed line-handler field.
(irc-bot-dispatch-line): Renamed from irc-bot-dispatch-raw-line.
All callers changed.
(irc-bot-send-line): Moved position in file.
(irc-bot-handle-line): New method.
(irc-bot-handle-misc-input, irc-bot-handle-user-join)
(irc-bot-handle-user-quit): New stub methods.

* demos/ircbot.scm (<my-irc-bot>): New variable.
(irc-bot-handle-line): Now a generic method extending same named
method in 8sync/systems/irc.scm.  Previously was `handle-line'.
(run-bot): Use <my-irc-bot>.
(main): Remove debugging pk.

7 years agoirc: Update irc code to use actors.
Christopher Allan Webber [Fri, 23 Dec 2016 14:50:06 +0000 (08:50 -0600)]
irc: Update irc code to use actors.

Also some significant cleanup.  But more can still be done!

* 8sync/systems/irc.scm: Adjust exports.
(irc-line, irc-format, irc-display, irc-send-message)
(irc-send-formatted, handle-login, <irc-line>)
(default-handle-privmsg, make-handle-line, irc-loop)
(default-line-handler, queue-and-start-irc-agenda!): Removed.
(parse-line): Return multiple values rather than the <irc-line>
record.
(irc-line-username): Update to use prefix rather than pulling
out of <irc-line>.
(condense-privmsg-line): Update docstring to call `is-action' `emote?'.
(echo-message): Renamed from echo-back-message.  Change argument list
and body to match new version and add docstring.
(<irc-bot>, irc-bot-username, irc-bot-server, irc-bot-channels)
(default-irc-port, irc-bot-line-handler, irc-bot-socket)
(irc-bot-realname, irc-bot-init, irc-bot-main-loop, irc-bot-dispatch-line)
(irc-bot-send-line): New variables.

* demos/ircbot.scm (handle-line): Renamed from `handle-message'.
Adjust body for actors edition.
(display-help, parse-args, run-bot): New variables.
(main): Adjusted for new structure.

7 years agoactors: Add docstring to hive-create-actor*.
Christopher Allan Webber [Fri, 23 Dec 2016 01:46:46 +0000 (19:46 -0600)]
actors: Add docstring to hive-create-actor*.

* 8sync/actors.scm (hive-create-actor*): Added docstring.

7 years agoactors: Move error propagation within <-wait; add <-wait*, <-reply-wait*.
Christopher Allan Webber [Wed, 21 Dec 2016 23:00:43 +0000 (17:00 -0600)]
actors: Move error propagation within <-wait; add <-wait*, <-reply-wait*.

* 8sync/actors.scm (send-message): Rename xtra-params argument to
send-options and use it in aborting to the hive prompt.
(<-wait*, <-reply-wait*): New procedures.  These allow for adding
a send-options list as a first argument, including #:accept-errors.
These also wrap call wait-maybe-handle-errors.
(<-wait, <-reply-wait): Updated as thin wrappers around <-wait* and
<-reply-wait*.
(wait-maybe-handle-errors): New procedure.
(<waiting-on-reply>): New record type.
(hive-process-message): Update to accept send-options and make use
of <waiting-on-reply>.  Removes error handling, which now hapens in
wait-maybe-handle-errors.

7 years agoactors: Generalize the <-foo methods functionality into send-message.
Christopher Allan Webber [Wed, 21 Dec 2016 18:51:33 +0000 (12:51 -0600)]
actors: Generalize the <-foo methods functionality into send-message.

* 8sync/actors.scm (send-message): New procedure.
(<-, <-wait, <-reply, <-auto-reply, <-reply-wait): Update to use
send-message.

7 years agoactors: Switch coroutine waiting code over to using case.
Christopher Allan Webber [Tue, 20 Dec 2016 23:09:19 +0000 (17:09 -0600)]
actors: Switch coroutine waiting code over to using case.

* 8sync/actors.scm (hive-process-message): Update resume-waiting-coroutine
code over to using a case statement.

7 years agoagenda: Fixing exports.
Christopher Allan Webber [Tue, 20 Dec 2016 21:51:56 +0000 (15:51 -0600)]
agenda: Fixing exports.

* 8sync/agenda.scm: Removed deprecated variables 8sync-delay, 8sync-run,
8sync-run-at, and 8sync-run-delay.
Added 8usleep.

7 years agoactors: Document the <message> records's fields.
Christopher Allan Webber [Tue, 20 Dec 2016 21:28:10 +0000 (15:28 -0600)]
actors: Document the <message> records's fields.

* 8sync/actors.scm (<message>): Add comments.

7 years agoAdd toplevel 8sync.scm file.
Christopher Allan Webber [Tue, 20 Dec 2016 20:23:45 +0000 (14:23 -0600)]
Add toplevel 8sync.scm file.

* 8sync.scm: New file.
* Makefile.am: Add it.

7 years agoactors: Move actors center-stage in 8sync.
Christopher Allan Webber [Tue, 20 Dec 2016 18:11:04 +0000 (12:11 -0600)]
actors: Move actors center-stage in 8sync.

* 8sync/systems/actors.scm: Renamed to 8sync/actors.scm.
* 8sync/systems/actors/debug.scm: Renamed to 8sync/debug.scm.
* Makefile.am: Update for renamed files.
* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm:
* tests/test-actors.scm: Update import of actors module to new location.

7 years agobuild: Releasing v0.3.0. v0.3.0
Christopher Allan Webber [Mon, 19 Dec 2016 20:48:09 +0000 (14:48 -0600)]
build: Releasing v0.3.0.

* configure.ac: Bumping version number to 0.3.0.

7 years agoweb: Deprecate current web system.
Christopher Allan Webber [Mon, 19 Dec 2016 20:37:14 +0000 (14:37 -0600)]
web: Deprecate current web system.

The web system needs a rewrite, so officially deprecating, but keeping
code around in a file for reference.

* 8sync/systems/web-deprecated.scm: Renamed from 8sync/systems/web.scm.
* demos/hello-web.scm: Removed.
* Makefile.am: Remove references to above.

7 years agoNEWS: Updating news to current 0.3.0 state.
Christopher Allan Webber [Mon, 19 Dec 2016 16:00:35 +0000 (10:00 -0600)]
NEWS: Updating news to current 0.3.0 state.

* NEWS: New 0.3 section.

7 years agoactors: Deprecate old facilities.
Christopher Allan Webber [Sat, 17 Dec 2016 15:30:32 +0000 (09:30 -0600)]
actors: Deprecate old facilities.

* 8sync/systems/actors.scm (simple-dispatcher, build-actions)
  (make-action-dispatch): Remove.
  (mhandlers): Renamed to build-actions.

7 years agodemos: Update demos to new conventions.
Christopher Allan Webber [Sat, 17 Dec 2016 03:47:51 +0000 (21:47 -0600)]
demos: Update demos to new conventions.

* demos/actors/botherbotherbother.scm:
* demos/actors/robotscanner.scm:
* demos/actors/simplest-possible.scm: Update demos to use new
  conventions around actions slot, lack of message-ref, etc.

7 years agoactors: Adding "mhandlers" and updating define-simple-actor to use it.
Christopher Allan Webber [Sat, 17 Dec 2016 00:20:28 +0000 (18:20 -0600)]
actors: Adding "mhandlers" and updating define-simple-actor to use it.

We also mark a whole range of abstractions as deprecated, but those will
be removed as they're phased out of use.

* 8sync/systems/actors.scm (mhandlers): New macro.
  (define-simple-actor): Update to use mhandlers.

7 years agoactors: Remove wrap-apply from actor-inheritable-message-handler call.
Christopher Allan Webber [Fri, 16 Dec 2016 17:00:09 +0000 (11:00 -0600)]
actors: Remove wrap-apply from actor-inheritable-message-handler call.

* 8sync/systems/actors.scm (actor-inheritable-message-handler): Move location.
  (<actor>): Switch init-value of actor-inheritable-message-handler to
  drop wrap-apply.

7 years agoactors: Add "inheritable" message handler as default message-handler.
Christopher Allan Webber [Fri, 16 Dec 2016 16:57:11 +0000 (10:57 -0600)]
actors: Add "inheritable" message handler as default message-handler.

* 8sync/systems/actors.scm (actor-inheritable-message-handler): New
  variable.
  (<actor>): New actions slot, and adjust init-value of message-handler
  to be actor-inheritable-message-handler.

7 years agoactors: Add %current-actor parameter.
Christopher Allan Webber [Thu, 15 Dec 2016 16:18:34 +0000 (10:18 -0600)]
actors: Add %current-actor parameter.

This allows actors which may call out long procedures, such as a web
worker, to still be able to have access their actor so they can send
messages to other actors.

* 8sync/systems/actors.scm (%current-actor): New variable.
  (hive-process-message): Update to parameterize %current-actor.

7 years agoagenda: Add 8usleep.
Christopher Allan Webber [Wed, 14 Dec 2016 23:41:50 +0000 (17:41 -0600)]
agenda: Add 8usleep.

* 8sync/agenda.scm (8usleep): New variable.
  (8sleep): Update to refer to argument as "secs" rather than "time".

7 years agodoc: Remove (inaccurate) version number from docs.
Christopher Allan Webber [Wed, 14 Dec 2016 17:40:04 +0000 (11:40 -0600)]
doc: Remove (inaccurate) version number from docs.

* doc/8sync.texi: Remove version number.

7 years agodoc: Remove the indentation after newline structure.
Christopher Allan Webber [Wed, 14 Dec 2016 17:33:20 +0000 (11:33 -0600)]
doc: Remove the indentation after newline structure.

We still wrap on sentence breaks.

* doc/8sync.texi: Remove indentation after newlines.

7 years agoNEWS: Mention the actor model subsystem added to 8sync 0.2.
Christopher Allan Webber [Tue, 13 Dec 2016 22:29:34 +0000 (16:29 -0600)]
NEWS: Mention the actor model subsystem added to 8sync 0.2.

* NEWS: Add 8sync 0.2 section and mention the actor model subsystem.

7 years agoactors: Add msg-val and add docstring to msg-receive. remove-define-mhandler
Christopher Allan Webber [Tue, 13 Dec 2016 18:43:42 +0000 (12:43 -0600)]
actors: Add msg-val and add docstring to msg-receive.

* 8sync/systems/actors.scm (msg-receive): Add docstring, and change
  parameter name from "the-message" to just "message".
  (msg-val): New procedure.

7 years agoactors: Add comment about adding deferred-slot to <message>.
Christopher Allan Webber [Mon, 12 Dec 2016 21:08:23 +0000 (15:08 -0600)]
actors: Add comment about adding deferred-slot to <message>.

* 8sync/systems/actors.scm: Add comment.

7 years agoactors: Remove => alias.
Christopher Allan Webber [Mon, 12 Dec 2016 18:48:20 +0000 (12:48 -0600)]
actors: Remove => alias.

Seems it causes problems with cond and etc.  No big surprise.

* 8sync/systems/actors.scm (=>): Removed.

7 years agoactors: Fix "unrewindable continuation" issue with error handling code.
Christopher Allan Webber [Mon, 12 Dec 2016 18:44:53 +0000 (12:44 -0600)]
actors: Fix "unrewindable continuation" issue with error handling code.

* 8sync/systems/actors.scm (hive-reply-with-error, hive-process-message):
  Move responding with error to outside of the catch statement.
  This was resulting in unrewindable continuation issues.

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.