SB-UNICODE:WHITESPACE-P doesn’t return T like the manual says.

Bug #1531071 reported by James A. Crippen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
New
Undecided
Unassigned

Bug Description

1. The manual at http://sbcl.sourceforge.net/manual/index.html#Unicode-property-access says that SB-UNICODE:WHITESPACE-P returns T if the argument is a whitespace character and NIL otherwise. But instead the return value is the same as the result of CHAR-CODE which is not T.

2. (sb-unicode:whitespace-t #\Space) → 32

3. SBCL 1.3.1

4. Darwin Ghushka.local 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64

5. (:QUICKLISP :ASDF-PACKAGE-SYSTEM :ASDF3.1 :ASDF3 :ASDF2 :ASDF :OS-MACOSX
 :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE :64-BIT :64-BIT-REGISTERS
 :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :BSD :C-STACK-IS-CONTROL-STACK
 :COMMON-LISP :COMPARE-AND-SWAP-VOPS :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :DARWIN
 :DARWIN9-OR-BETTER :FLOAT-EQL-VOPS :FP-AND-PC-STANDARD-SAVE :GENCGC
 :IEEE-FLOATING-POINT :INLINE-CONSTANTS :INODE64 :INTEGER-EQL-VOP
 :INTERLEAVED-RAW-SLOTS :LINKAGE-TABLE :LITTLE-ENDIAN :MACH-EXCEPTION-HANDLER
 :MACH-O :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :OS-PROVIDES-PUTWC
 :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :PRECISE-ARG-COUNT-ERROR
 :RAW-INSTANCE-INIT-VOPS :SB-CORE-COMPRESSION :SB-DOC :SB-EVAL :SB-LDB
 :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-TEST :SB-THREAD
 :SB-UNICODE :SBCL :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UD2-BREAKPOINTS :UNIX
 :UNWIND-TO-FRAME-AND-CALL-VOP :X86-64)

Tags: unicode
Revision history for this message
Philipp Matthias Schäfer (philipp-schaefer) wrote :

I rewrote the docstrings to use the terminology of the spec (generalized boolean, true and false). Please comment on the sentence structure. I would be willing to rewrite them for all the cases, if a better scheme is proposed.

Revision history for this message
James A. Crippen (jcrippen) wrote :

I think it would be better to explain the term ‘generalized boolean’ even though it is in the standard. Maybe instead something like “Returns a generalized boolean: CHARACTER if this argument has the specified PROPERTY, otherwise the false value NIL.” Likewise for WHITESPACE-P, “Returns a generalized boolean: CHARACTER if this argument is whitespace according to
+Unicode, otherwise the false value NIL.”

Revision history for this message
Stas Boukarev (stassats) wrote :

I'd rather return T and not expose an implementation detail.

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 1531071] Re: SB-UNICODE:WHITESPACE-Pdoesn’treturn T like the manual says.

Stas Boukarev <email address hidden> writes:

> I'd rather return T and not expose an implementation detail.

I think that's fine, but I think the docstring itself should not say "T"
specifically, but simply say "returns true if ... and nil if not"

Best,

Christophe

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.