Singleton objects in Guile Scheme
When I wrote guile-messagepack I needed an object to represent the nil
value, which embodies the concept of "nothingness" or "no value" in
MessagePack. None of the existing objects like #f
or '()
were adequate,
so I decided to make a new one: nothing
. It does not make sense for there to
be multiple instance of nothing
, so it had to be a singleton. In this blog
post I will describe a way of creating such a singleton.