unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Howard <christopher.howard@qlfiles.net>
To: Neil Jerram <neil@ossau.homelinux.net>, guile-user@gnu.org
Subject: Re: Signals / Messages / Events / ...?
Date: Wed, 03 Jan 2018 06:11:20 -0900	[thread overview]
Message-ID: <1514992280.4049.5.camel@qlfiles.net> (raw)
In-Reply-To: <f2992b7b-a4aa-516e-7365-17f3b292e711@ossau.homelinux.net>

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

On Wed, 2018-01-03 at 11:53 +0000, Neil Jerram wrote:
> 
> Well, one Lispy mechanism in that area is hooks.  For example, from
> some 
> of my old code:
> 
> ;; Changes to modem registration state are indicated by calling this
> ;; hook with args STATE and PROPERTIES.  STATE can be 'none, meaning
> ;; that there is currently no modem; 'unregistered, meaning that
> there
> ;; is a modem but it isn't registered with the network; or
> ;; 'registered, meaning that the modem is registered with the
> network.
> ;; If STATE is 'registered, PROPERTIES is an alist of registration
> ;; properties; otherwise PROPERTIES is #f.
> (define registration-hook (make-hook 2))
> 
> (define (add-registration-hook proc)
>    (add-hook! registration-hook proc))
> 
> (define (notify-registration state properties)
>    (run-hook registration-hook state properties))
> 
> Does that serve your purpose at all?
> 
> Best wishes - Neil
> 
> 

I think that should work. Only part I'm not sure about is if you can
have a "one-off" procedure added to a hook... but you could just have
the procedure call remove-hook! to remove itself...?

-- 
https://www.debian.org/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-01-03 15:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-03  5:09 Signals / Messages / Events / ...? Christopher Howard
2018-01-03 11:53 ` Neil Jerram
2018-01-03 15:11   ` Christopher Howard [this message]
2018-01-03 19:53     ` Neil Jerram
2018-01-04  1:16 ` Matt Wette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1514992280.4049.5.camel@qlfiles.net \
    --to=christopher.howard@qlfiles.net \
    --cc=guile-user@gnu.org \
    --cc=neil@ossau.homelinux.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).