guile-user
[Top][All Lists]
Advanced

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

Re: [ANN] guile-msgpack: MessagePack for GNU Guile (+ help needed)


From: John Cowan
Subject: Re: [ANN] guile-msgpack: MessagePack for GNU Guile (+ help needed)
Date: Wed, 19 Sep 2018 10:12:04 -0400

On Wed, Sep 19, 2018 at 8:33 AM HiPhish <address@hidden> wrote:

Since using MessagePack with
> ports is a frequent task there is also a `pack!` procedure which takes in
> a
> port to pack to as well.
>

By convention, Scheme procedures whose only side effect is on a port
don't use the ! in their names: we write `read`, `write`, `display`, not
`read!`, `write!`, `display!`.

I would suggest calling them pack-and-write and read-and-unpack;
you can leave out the "and-" if you think those are too long.

How much is portability a concern? I know Guile implements *some* or r6rs,
> but
> I wasn't paying much attention to that. Is it something worth considering
> or
> should I just treat Guile as its own language that just so happens to be
> based
> on Scheme?
>

The Scheme community is small enough that doing a little bit to make
libraries
more portable is worthwhile.  I'd use R6RS `library` instead of
Guile-specific
`define-module`, and maybe put the code proper into a separate file from the
module furniture.  (To use `include` or any other Guile-specific procedure
 in an R6RS library, add `(only (guile) include)` to the imports list.)
Using
Guile-specific procedures is not usually a problem, as there are probably
equivalents in other Schemes.


> The extension type `ext` (msgpack/ext.scm) is a pair of a signed 8-bit
> integer
> and a bytevector. The constructor does not enforce this condition, the two
> slots can be really anything. What it the proper way of enforcing this in
> Guile? I know Common Lisp has type declarations and Racket has contracts,
> but
> what does Guile have?
>

Usually there's just using a constructor wrapper that checks the types
before
calling the real constructor (`cons` in this case).


> Is there a way of making it unpack as many as it can?


Returning a list of values is idiomatic.  It is actually possible for a
caller to
receive multiple values without knowing how many it's going to get, but it's
probably more trouble than it's worth in this case.


> if anyone can recommend me a service for one-time donations that would
> be cool. All the services I could find were about fundraising for charity
> and
> stuff, not what I was looking for.
>

GoFundMe seems like the right thing.  They are large and reputable, they
only
take enough of your money to cover credit-card processing costs (for
personal
campaigns like this one), they are okay with small donations.  Although
they are
best known for crowdfunding personal emergencies, they do handle works of
art
as well (software is an art, we have Knuth's word for it).

-- 
John Cowan          http://vrici.lojban.org/~cowan        address@hidden
First known example of political correctness: After Nurhachi had united
all the other Jurchen tribes under the leadership of the Manchus, his
successor Abahai (1592-1643) issued an order that the name Jurchen should
be banned, and from then on, they were all to be called Manchus.
                --S. Robert Ramsey, The Languages of China


reply via email to

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