guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Announcing 8sync: an asynchronous programming language for Guile


From: Amirouche Boubekki
Subject: Re: Announcing 8sync: an asynchronous programming language for Guile
Date: Fri, 04 Dec 2015 03:15:48 +0100
User-agent: Roundcube Webmail/1.1.2

Héllo,


I've done some exploration regarding this topic; I think it might of interest or it's very naive.

It goes like this:

``` scheme

(define (loop-run-forever)
  (while #true
    (call-with-prompt 'loop
      loop-run-once
      (lambda (cc callback) (callback cc)))))

```

`loop-run-once` does the `do-select` thing and call scheduled task. Then we only need to wrap blocking calls inside `abort-to-prompt`, here an example with `read`:

```
(define (read/ sock)
  (abort-to-prompt 'loop (lambda (cc)
(loop-add-reader sock (lambda () (cc (read sock)))))))
```

`loop-add-reader` is procedure that register a callback against `select` to restart the computation where it was left it's equivalent to `port-request-read` machinery.


I attached an example server, the client is vanilla imperative code. Also, it doesn't implement exception propagation.


I don't understand the point of %8sync macro when all blocking calls can be expressed directly in terms of abort-to-prompt.


HTH

Attachment: client.scm
Description: Text document

Attachment: plain.scm
Description: Text document

Attachment: server.scm
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]