From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: HiPhish Newsgroups: gmane.lisp.guile.user Subject: Re: A value for "nothing" Date: Thu, 13 Sep 2018 23:49:10 +0200 Message-ID: <8995890.4T62A8Hj0k@aleksandar-ixtreme-m5740> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1536875277 27249 195.159.176.226 (13 Sep 2018 21:47:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Sep 2018 21:47:57 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 13 23:47:53 2018 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g0ZSq-0006z5-Vo for guile-user@m.gmane.org; Thu, 13 Sep 2018 23:47:53 +0200 Original-Received: from localhost ([::1]:44442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0ZUx-0003j1-3F for guile-user@m.gmane.org; Thu, 13 Sep 2018 17:50:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g0ZUY-0003is-S4 for guile-user@gnu.org; Thu, 13 Sep 2018 17:49:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g0ZUU-0005V6-4F for guile-user@gnu.org; Thu, 13 Sep 2018 17:49:38 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:50579) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g0ZUP-0005IA-Cu for guile-user@gnu.org; Thu, 13 Sep 2018 17:49:30 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 49B7C21163 for ; Thu, 13 Sep 2018 23:49:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1536875352; bh=DY+1pKkeSsr9qH9ZB/TVb0hJxfDBR3FQjJ73IfYwO8k=; h=From:To:Subject:Date:From; b=EeGMrD55X4RY0WSLfwDIHUJ8bPbE2m8p9eOyVq/3OoDFw8uTwo+qeNVgyqHnCFF5d Y9i4q2bzFTyujkgVI0fsoAz+LZbL+XkK8LzfzMCMh7H9n2A0Q5tgZlPsKtOc+6MkwQ bdpAFvfYk7rCNJgn/Nq3s4q+Bg9WNxz811AJ8JQapUE0LOUQiH5rm5pED4+cI1ck8e SoSzx+onsmqn/3xjyhbywOAPMf+dIaMPkd7t6gTLJVFpq4+Hw/Sxxo6Wxr2UftpyHa WvUsuwRqDK9p/b798CYqa7hY11nmPrxJxBAtANz6Cn1vLydhyPrFXUv8i8exQH06D6 Zr+Y3BuynHLMQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 42BC3C3dcnz9rxF for ; Thu, 13 Sep 2018 23:49:11 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.67.36.66 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14872 Archived-At: After taking the advice from the mailing list users this is what I have com= e=20 up with: (define-module (msgpack nil) #:use-module ((srfi srfi-9) #:select (define-record-type)) #:export (nil? (get-nil . nil))) =20 (define-record-type nil (make-nil) ; The raw constructor will not get exported nil?) =20 (define get-nil ; This will be renamed on export (let ((the-nil (make-nil))) ; Singleton instance (=CE=BB () "- Scheme procedure: nil Return the unique object representing nothingness in MessagePack. =20 All calls to this procedure return objects which are 'eq?' to each=20 other." the-nil))) The procedure `get-nil` gets exported as `nil` and returns a singleton=20 instance of my `nil` type. This way `(eq? (nil) (nil))` is always `#t`. The= =20 only issues is that the `nil?` predicate collides with Guile's own `nil?`=20 predicate, so users will have to prefix or rename it when importing. I woul= d=20 prefer not to export these two procedures with prefixes like `msgpack-nil` = out=20 of the box, it's really ugly :/ What is the difference between `nil?` and=20 `null?` anyway? The former is not listed in the procedure index of the Guil= e=20 manual. What do you think?