[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48318: (ice-9 match) does not allow distinguishing between () and #n
From: |
Taylan Kammer |
Subject: |
bug#48318: (ice-9 match) does not allow distinguishing between () and #nil |
Date: |
Thu, 13 May 2021 21:14:26 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
Hi Maxime,
I believe that match conflating () and #nil is the right thing,
even if the current implementation does it unintentionally.
Those two values should be considered "the same" in most situations
even though (eqv? #nil '()) is false.
In fact I think they should be equal? to each other. It feels
wrong that (equal? '(foo . #nil) '(foo . ())) evaluates to false,
even though both arguments represent the list '(foo).
Please note that #nil is not ever supposed to be used intentionally.
It's there purely as an Elisp compatibility trick, and the only time
Scheme could should receive it is when receiving data generated by
Elisp code. For instance when Elisp code generates a list, it would
be terminated by #nil. (Which is why I think it should equal? '().)
Does that make sense to you? I'm not sure what the Guile maintainers
would say about (equal? #nil '()).
- Taylan