Opened 3 years ago

Closed 3 years ago

#1400 closed defect (fixed)

Loop's destructuring bind is not conformant

Reported by: PuercoPop Owned by: rme
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:

Description

When passing less values than variables to destructure against CCL raises a SIMPLE-PROGRAM-ERROR

(loop :with (a b) := '(nil))
;; =>
(NIL) can't be destructured against the lambda list (A
                                                     B
                                                     . #:LOOPVAR-8347), because it does not contain at least 2 elements.

The CLHS says that b should be given a value of nil in this case.

During loop expansion, each variable in the variable list is matched with the values in the values list. If there are more variables in the variable list than there are values in the values list, the remaining variables are given a value of nil

6.1.1.7 Destructuring

SBCL which shares the same loop implementation of CCL handled this bug in this way.

Change History (2)

comment:1 Changed 3 years ago by rme

  • Owner set to rme
  • Status changed from new to assigned

comment:2 Changed 3 years ago by rme

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [16808]) When doing loop destructuring, if there are more variables in the variables list than there are values in values list, give remaining variables the value of NIL.

This behavior is described in 6.1.1.7 of the spec. Closes ticket:1400.

This code an adaptation of code from SBCL that fixes the same issue.

Note: See TracTickets for help on using tickets.