[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A value for "nothing"
From: |
HiPhish |
Subject: |
A value for "nothing" |
Date: |
Sun, 26 Aug 2018 12:13:31 +0200 |
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 Racket there is the `(void)` [2] procedure which returns a `#<void>`
object, so that's what I am using there [3][4]. Any suggestions for Guile?
[1] https://msgpack.org/
[2] http://docs.racket-lang.org/reference/void.html?q=void
[3] https://gitlab.com/HiPhish/MsgPack.rkt/blob/master/msgpack/unpack.rkt#L47
[4] https://gitlab.com/HiPhish/MsgPack.rkt/blob/master/msgpack/pack.rkt#L35