Wanted: Signal an error on :test nil
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Triaged
|
Low
|
Unassigned |
Bug Description
What I do:
(find 2 '(1 2 3) :test nil)
What happens:
Same thing as if (find 2 '(1 2 3)) or (find 2 '(1 2 3) :test #'eql) had been specified: => 2
What I expected to happen:
CLHS FIND says that TEST is "a designator for a function of two arguments that returns a generalized boolean." The behavior of NIL as default function only applies to the :KEY argument.
Someone who relies on the false equivalence (find item sequence :test nil) == (find item sequence) would inadvertently make his code non-portable, so signaling an error would be helpful.
SBCL version: 1.0.42
uname -a: Linux dynamorph 2.6.32-30-generic #59-Ubuntu SMP Tue Mar 1 21:30:21 UTC 2011 i686 GNU/Linux
*features*:
(:SWANK :QUICKLISP :SB-BSD-
:SBCL :SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS :SB-UNICODE :SB-EVAL
:SB-SOURCE-
:LARGEFILE :GENCGC :STACK-
:COMPARE-
:STACK-
:STACK-
:CYCLE-COUNTER :INLINE-CONSTANTS :MEMORY-
:OS-PROVIDES-
Changed in sbcl: | |
importance: | Undecided → Low |
status: | New → Triaged |
Maybe all you need to do is to update DEFKNOWNs for those functions.
That would also make the compiler emit a warning at compile-time in case of (find ... :test nil)
which might happen e.g. after macro expansion.