unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Web development without connections to external repl (in geiser)
@ 2022-10-15 19:23 Dmitry Polyakov
  2022-10-16  4:49 ` Dmitry Polyakov
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Polyakov @ 2022-10-15 19:23 UTC (permalink / raw)
  To: guile-user


Hello guilers!

As far as I can see, current method for interactive web development is
to connect to external guile-instance-with-listen-option with geiser.

Using fibers, I thought I could run the web server in seperate thread
that dont block current one where, for example, I could rebind the
handler (via ice-9 atomics or something). But it's not, after eval
(run-server handler), repl get stuck. May be I misunderstood something?
This is code:

--8<---------------cut here---------------start------------->8---
(use-modules (ice-9 atomic)
	     (fibers)
	     (fibers scheduler)
	     (fibers web server))

(define v (make-atomic-box "some text sdf"))

(define (handler request body) (values '((content-type . (text/plain)))
				       (atomic-box-ref v)))


(run-server handler)
--8<---------------cut here---------------end--------------->8---



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Web development without connections to external repl (in geiser)
  2022-10-15 19:23 Web development without connections to external repl (in geiser) Dmitry Polyakov
@ 2022-10-16  4:49 ` Dmitry Polyakov
  2022-10-16  7:12   ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Polyakov @ 2022-10-16  4:49 UTC (permalink / raw)
  To: guile-user

Dmitry Polyakov <liltechdude@gmail.com> writes:

> Hello guilers!
>
> As far as I can see, current method for interactive web development is
> to connect to external guile-instance-with-listen-option with geiser.
>
> Using fibers, I thought I could run the web server in seperate thread
> that dont block current one where, for example, I could rebind the
> handler (via ice-9 atomics or something). But it's not, after eval
> (run-server handler), repl get stuck. May be I misunderstood something?
> This is code:

May this is because of main thread is blocked by REPL?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Web development without connections to external repl (in geiser)
  2022-10-16  4:49 ` Dmitry Polyakov
@ 2022-10-16  7:12   ` Dr. Arne Babenhauserheide
  0 siblings, 0 replies; 3+ messages in thread
From: Dr. Arne Babenhauserheide @ 2022-10-16  7:12 UTC (permalink / raw)
  To: Dmitry Polyakov; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]


Dmitry Polyakov <liltechdude@gmail.com> writes:

>> Using fibers, I thought I could run the web server in seperate thread
>> that dont block current one where, for example, I could rebind the
>> handler (via ice-9 atomics or something). But it's not, after eval
>> (run-server handler), repl get stuck. May be I misunderstood something?
>> This is code:
>
> May this is because of main thread is blocked by REPL?

Have a look at the cooperative REPL in chickadee:
https://www.gnu.org/software/guile/manual/html_node/Cooperative-REPL-Servers.html
https://dthompson.us/manuals/chickadee/Live-Coding.html

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-16  7:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-15 19:23 Web development without connections to external repl (in geiser) Dmitry Polyakov
2022-10-16  4:49 ` Dmitry Polyakov
2022-10-16  7:12   ` Dr. Arne Babenhauserheide

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).