Skip to content

Commit b249831

Browse files
committed
Update docs
1 parent 2e94c87 commit b249831

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ def deps do
8484
end
8585
```
8686

87-
Note that this is *experimental software* and stuff *will* break. Please don’t rely on this for anything production-grade. Not yet at least.
87+
Note that this is *experimental software* and stuff *will* break. Please don't rely on this for anything production-grade. Not yet at least.
8888

8989

9090
## What is a choreography?
9191

92-
A choreography is a birds-eye view of an interaction between nodes in a distributed system. You have some set of *actors/—in Elixir parlance processes—that exchange /messages* while also running some /local computation/—i.e. functions that don’t rely on talking to other nodes in the system.
92+
A choreography is a birds-eye view of an interaction between nodes in a distributed system. You have some set of *actors/—in Elixir parlance processes—that exchange /messages* while also running some /local computation/—i.e. functions that don't rely on talking to other nodes in the system.
9393

9494

9595
### Choreography syntax
9696

97-
Chorex introduces some new syntax for choreographies. Here’s a breakdown of how it works:
97+
Chorex introduces some new syntax for choreographies. Here's a breakdown of how it works:
9898

9999
```elixir
100100
defchor [Actor1, Actor2, ...] do
@@ -194,7 +194,7 @@ defmodule Bookstore do
194194
end
195195
```
196196

197-
You will need to make a module for every actor you specify at the beginning of `defchor` and mark which actor you’re implementing like so:
197+
You will need to make a module for every actor you specify at the beginning of `defchor` and mark which actor you're implementing like so:
198198

199199
```elixir
200200
defmodule MyFirstActor do
@@ -210,7 +210,7 @@ defmodule MySecondActor do
210210
end
211211
```
212212

213-
These modules will need to implement all of the local functions specified in the choreography. Chorex will use Elixir’s behaviour mechanism to warn you if you don’t implement every function needed. In the above example, the `MySecondActor` implements the role of `Actor2` in the choreography, and therefore needs to implement the `some_computation` function.
213+
These modules will need to implement all of the local functions specified in the choreography. Chorex will use Elixir's behaviour mechanism to warn you if you don't implement every function needed. In the above example, the `MySecondActor` implements the role of `Actor2` in the choreography, and therefore needs to implement the `some_computation` function.
214214

215215
**Note:** *Actor names do not need to be the same as the modules implementing them!* It is *useful* to do that, but there exist instances where you might want to write one choreography and implement it in different ways.
216216

@@ -236,14 +236,22 @@ receive do
236236
end
237237
```
238238

239+
## Shared-state choreographies
240+
241+
Sometimes you might have a choreography where one or more actors need to share some state between different instantiations of the choreography. Returning to our bookseller example, the bookseller might need to keep track of a finite stock of books and ensure that no book gets double-sold.
242+
243+
Chorex can let you share state between different instances of the bookseller actor through a proxy. Details are under the `Chorex` module.
239244

240245
## Using a choreography with the rest of your project
241246

242-
The local functions are free to call any other code you have—they’re just normal Elixir. If that code sends and receives messages not managed by the choreography library, there is no guarantee that this will be deadlock-free.
247+
The local functions are free to call any other code you have—they're just normal Elixir. If that code sends and receives messages not managed by the choreography library, there is no guarantee that this will be deadlock-free.
243248

244249

245250
# Development
246251

252+
Chorex is under active development and things will change and break rapidly.
253+
254+
If you find any bugs or would like to suggest a feature, please [open an issue on GitHub](https://github.com/utahplt/chorex/issues).
247255

248256
## Changelog
249257

@@ -263,9 +271,9 @@ We will collect change descriptions here until we come up with a more stable for
263271
The `defchor` macro is implemented in the `Chorex` module.
264272

265273
- The `defchor` macro gathers a list of actors.
266-
- For each actor, call `project` on the body of the choreography. The `project` function keeps track of the current actor as the “label” variable. (This vernacular borrowed from the academic literature.)
274+
- For each actor, call `project` on the body of the choreography. The `project` function keeps track of the current actor as the `label` variable. (This vernacular borrowed from the academic literature.)
267275
- The functions `project` and `project_sequence` are mutually recursive: `project_sequence` gets invoked whenever `project` encounters a block with multiple instructions.
268-
- The `project` function walks the AST, it gathers a list of functions that will need to be implemented by each actor’s implementing module, as well as a list of top-level functions for each projection.
276+
- The `project` function walks the AST, it gathers a list of functions that will need to be implemented by each actor's implementing module, as well as a list of top-level functions for each projection.
269277
- This gathering is handled by the `WriterMonad` module, which provides the `monadic do ... end` form as well as `return` and `mzero`.
270278
- Finally the macro generates modules for each actor under the `Chorex` module it generates.
271279

@@ -366,7 +374,7 @@ defmodule Chorex do
366374
end
367375
```
368376

369-
You can see there’s a `Chorex.Alice` module and a `Chorex.Bob` module.
377+
You can see there's a `Chorex.Alice` module and a `Chorex.Bob` module.
370378

371379

372380
## Testing

lib/chorex.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,8 @@ defmodule Chorex do
849849
@doc """
850850
Get the actor name from an expression
851851
852-
iex> Chorex.actor_from_local_exp((quote do: Foo.bar(42)), __ENV__)
853-
{:ok, Foo}
852+
iex> Chorex.actor_from_local_exp((quote do: Foo.bar(42)), __ENV__)
853+
{:ok, Foo}
854854
"""
855855
def actor_from_local_exp({{:., _, [actor_alias | _]}, _, _}, env),
856856
do: {:ok, Macro.expand_once(actor_alias, env)}

0 commit comments

Comments
 (0)