guile-user
[Top][All Lists]
Advanced

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

Re: A value for "nothing"


From: Panicz Maciej Godek
Subject: Re: A value for "nothing"
Date: Mon, 27 Aug 2018 10:29:24 +0200

pon., 27 sie 2018 o 10:17 <address@hidden> napisał(a):

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Mon, Aug 27, 2018 at 02:17:06AM +0200, Panicz Maciej Godek wrote:
> > niedz., 26 sie 2018 o 16:09 HiPhish <address@hidden> napisał(a):
> >
> > > Hello Schemers,
> > >
> > > I am writing an implementation of MessagePack [1] for Guile and a part
> of
> > > the
> > > spec is the presence of a "nil" data type. What would be a good value
> to
> > > express "nothing" in Guile? I cannot use '() because that would be
> > > indistinguishable from the empty list, so I thought that the return
> value
> > > of a
> > > function that returns nothing would be a good fit. The function
> `display`
> > > for
> > > example returns an `#<unspecified>` value, but the only way of
> producing
> > > it
> > > without side effects so for is the value of `(if #f #f)`. Is there a
> > > better
> > > way?
> > >
> > >
> > In my experience, if #f doesn't make sense as a legal value, then using
> #f
> > is probably the idiomatic Scheme way to go.
>
> [...]
>
> In this case, as msgpack has explicit true and false values, those seem
> the "natural" correspondents of Scheme's #t and #f.
>

If that's the case, then perhaps actually returning no value (as in the
(values) form with no arguments) is the way to go?


reply via email to

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