Skip Menu |

This queue is for tickets about the LISP CPAN distribution.

Report information
The Basics
Id: 21248
Status: new
Priority: 0/
Queue: LISP

People
Owner: Nobody in particular
Requestors: murawaki [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.01
Fixed in: (no value)



Subject: zero, the empty string, and "0" are erroneously interpreted as NIL
Those which are false in a boolean test (zero, the empty string and "0") are erroneously interpreted as NIL. * Steps to reproduce: $list = LISP->new([2, 0, 1]); # (2 0 1) printf "%s\n", $list->string; # (2 NIL 1)!!! * The cause of the bug The subroutine "new" of LISP::List is buggy. Lines 52-54: my $car = ref eq 'ARRAY' && $class->new($_) || defined && $_ || $NIL; The fourth conditional expression is evaluated as false because $_ is 0, and $NIL is assigned to $car.
From: murawaki [...] gmail.com
The subroutine 'string' is also buggy: while (listp($list) and !nilp($list) and my $elem = $list->pop) { The third test is erroneously evaluated as false if $elem is zero, the empty string or "0".