[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] [ANN] Zephyros Chicken bindings (attn osx users)
From: |
Moritz Heidkamp |
Subject: |
Re: [Chicken-users] [ANN] Zephyros Chicken bindings (attn osx users) |
Date: |
Thu, 12 Sep 2013 11:04:47 +0200 |
Hey Richo,
thanks for your contribution to the Chicken ecosystem!
richo <address@hidden> writes:
> I'd love a) For people to use it, and b) feedback on the code.
As for a), I'm not an OS X user so I can't but as for b) I figured I can
give you a small hint:
> (define (send datum thunk)
> (call/next-id (lambda (id)
> (register-callback id thunk)
> (with-output-to-port zeph-out (lambda ()
> (let* ((payload (apply vector id datum))
> (json-payload (json->string payload)))
> (write-string json-payload)
> (write-string "\n"))))
> id)))
Here you can just immediately serialize JSON into the output port using
`(write-json payload)`. Also, I would advise you not to use
`with-output-to-port` but instead pass the port to write calls
explicitly as implicitly redirecting output can be a source of very
subtle bugs :-)
I'm not sure I understand how `send-get-value` works. It kind of looks
too clever to me but maybe I'm missing something.
Moritz