doc: Fix initial sleeper.
[8sync.git] / NEWS
1 # -*- mode: org; -*-
2
3 #+TITLE: 8sync NEWS
4
5 : Copyright (C) 2015-2017  Christopher Allan Webber
6
7 : Copying and distribution of this file, with or without modification, are
8 : permitted in any medium without royalty provided the copyright notice
9 : and this notice are preserved.
10
11 * 8sync 0.4.2
12
13 AKA, 8sync FOSDEM edition!  Contains all the code necessary to run
14 Mudsync, as demonstrated at FOSDEM 2017.
15
16 ** Web server actor
17
18 The old webserver code has been converted to being wrapped in an
19 actor.
20
21 ** Websocket server actor
22
23 New websocket code, courtesy David Thompson's work on guile-websocket.
24 Currently this code is snarfed straight into 8sync; in the future
25 8sync may use guile-websocket as an independent library.
26
27 ** REPL can notify subscribers
28
29 Subscribers can be notified to run after every tick of the REPL loop.
30 This way other actors who are looking for particular commands entered
31 at the REPL triggering something (for instance, inject-gameobj! in
32 Mudsync) have a chance to run.
33
34 * 8sync 0.4
35 ** Actors are now "center stage"
36
37 You can now import a toplevel (8sync) module, and this module includes
38 the full actor model system.  The actor model is now *the* way to
39 handle concurrent synchronization in 8sync.  So, 8sync is officially
40 less about its event loop, and more about the actor model.  (It is
41 even possible that in the future, 8sync's actor model will be able to
42 run on another event loop.)
43
44 ** New 8sync tutorial
45
46 The manual as been expanded with a full tutorial, walking from
47 extending an existing actor by writing an irc bot, to writing your own
48 basic actors, to writing network actors.
49
50 ** Better error propagation
51
52 When actors wait on other procedures, the "wait" handling code happens
53 within the actor's message handler, rather than skipping execution
54 from the outside.  This means it's possible to catch a general purpose
55 error named 'hive-unresumable-coroutine within the message handler
56 itself.
57
58 (The name of the symbol in the thrown exception may change in a future
59 release.)
60
61 ** IRC bot is now an actor
62
63 The irc bot code officially has become actor'ified, under the
64 <irc-bot> class.
65
66 ** REPL handling via an actor
67
68 The cooperative REPL code now also is handled via an actor.  See
69 <repl-manager>.
70
71 ** Major simplifications/cleanup of the agenda
72
73 The agenda is significantly less bloated than it was; with actors
74 taking center stage, many previous (and somewhat wonkily written)
75 chunks of code have been removed or simplified.
76
77 ** "from" actor is now implicit in sending a message in <-foo procedures
78
79 For the various <- style procedures, the actor is now explicitly
80 gathered from a parameter managed via the Hive.
81
82 ** New procedures: <-*, <-reply*
83
84 <-* and <-reply* have been added, which like <-wait* and <-reply-wait*
85 are like their non-starred equivalents, except they can take some
86 additional options.
87
88 ** New implicit '*init* and '*cleanup* action handlers.
89
90 There are now action handlers for '*init* and '*cleanup* which are
91 automatically invoked on actor initialization and destruction.
92
93
94 * 8sync 0.3
95
96 ** 8sync now targets Guile 2.2, Guile 2.0 dropped
97
98 In order to take advantage of Guile 2.2's suspendable ports facilities,
99 Guile 2.0 support has been dropped from 8sync.  (The Guile 2.1.X series is
100 the Guile 2.2 preview series.  A minimum of Guile 2.1.4 is required.)
101
102 While this may make 8sync slightly harder to install before major free
103 software distributions catch up (Guix users should have no problem), there
104 are major benefits to be found as well; networked code will be
105 significantly easier to write.  For more information, read on.
106
107
108 ** Suspendable ports overhaul
109
110 Previous 8sync networked code required hooking up a "port request" to the
111 scheduler, which would assign a port listening on a read or write event
112 with a callback.  By making use of Guile 2.2's new [[https://www.gnu.org/software/guile/docs/master/guile.html/Non_002dBlocking-I_002fO.html][suspendable ports]] code,
113 network enabled code mostly is completely straightforward to write.  If a
114 port is set to be nonblocking, attempting to read or write to a port that
115 would normally block will automatically suspend to 8sync's scheduler.  When
116 that port is discovered to be ready to read or write, the agenda will
117 automatically resume the suspended code.  As such, writing nonblocking code
118 looks almost exactly like writing blocking code in Guile... very little
119 extra work needs to be done.
120
121 8sync's internal demos and subsystems have also been updated to this
122 feature.
123
124 Not all ports will work with the new behavior, but most involving a file
125 descriptor will, which is the vast majority of I/O facilities.  Hopefully
126 over time the range of ports which are available to take advantage of this
127 feature will grow.
128
129 ** Overhaul of the "8sync" and "8sync-*" macros / procedures
130
131 The previous 8sync macro was realized to be a flawed design, more or less
132 emulating a synchronous call stack while providing the main feature of
133 yielding.  Thus 8sync, and several related macros (8sync-run-at, 8sync-run,
134 8sync-delay, 8sync-run-delay) have been removed, and 8sync-nowait has been
135 renamed to 8sync.
136
137 This leads to the question, "what is the primary coordination mechanism in
138 8sync between asynchronous processes?"  At least for now, this is the actor
139 subystem.  (While 8sync core continues to not require the actor subsystem,
140 for the reasons just described, many users will want to use it.)
141
142 ** Actor system overhaul
143
144 Given its increased role in 8sync, the actor system has also received
145 several major updates:
146
147 *** send-message and friends deprecated in favor of <- and friends
148
149 send-message, send-message-wait, reply-message, and reply-message-wait have
150 all been removed in favor of what was previously their aliases: <-, <-wait,
151 <-reply, and <-reply-wait.  The semantics are the same.
152
153 *** Message body now "applied" to a procedure
154
155 Previously to access a message body's contents, you used message-ref,
156 since a message body was merely a key-value property list.  There was
157 a special purpose message handler to make accessing the contents of a
158 message's body easier, with define-mhandler.  Now this is no more,
159 since invoking a message handler will call the procedure more or less
160 like so:
161
162 #+BEGIN_SRC scheme
163 (apply this-message-handler actor message (message-body this-message))
164 #+END_SRC
165
166 "Waiting" for a reply message continues to return the message as
167 before, but to access its body, the message is likewise applied, using
168 either "receive-message" or "call-with-message".
169
170 *** New %current-actor parameter
171
172 *** Default message handler now "inheritable"
173
174 The default message handler now looks at the actor slot of the actor
175 and its predecessors, which must have #:allocation #:class or
176 #:each-subclass.  The #:init-value of the actor slot is just an alist
177 of (action-symbol . message-handler).  There is convenient sugar for
178 defining this alist named "build-actions".  Use it!
179
180 If for some reason you want to control the way messages are handled
181 in some way that is different than the general pattern, you may
182 customize the message-handler slot of your actor.
183
184 ** New yield procedure
185
186 Allows asynchronously executing code to voluntarily yield to the scheduler.
187
188 ** New procedure: 8usleep
189
190 Like usleep, but asynchronous.
191
192 * 8sync 0.2
193
194 The primary update to this release is the inclusion of a new actor
195 model subsystem.
196
197 * 8sync 0.1
198
199 This is the first release of 8sync.  Welcome to 8sync!
200
201 The following features are present already in this very first release:
202
203  - An asynchronous event loop
204  - Delimited continuation support via the (8sync) command
205  - IRC bot demo