Ticket #390 (closed defect: fixed)

Opened 6 years ago

Last modified 4 years ago

Defstruct :include with :conc-name

Reported by: jch Owned by: rme
Priority: minor Milestone: Clozure CL 1.5
Component: Compiler Version: trunk
Keywords: defstruct Cc:

Description

Consider the following code, which is a simplified version of stuff that can be found in CL-Yacc:

(defstruct item x)
(defstruct (sub-item (:include item) (:conc-name item-)) y)

The ANSI CL spec explicitly states that this is allowed, in the description of :CONC-NAME in the description of DEFSTRUCT. However, CCL generates a warning:

;Compiler warnings for "/home/pps/jch/struct-test.lisp" :
;   In an anonymous lambda form at position 18: Duplicate definitions of ITEM-X, in this file

It would appear that CCL generates correct code, but I believe that this is by accident.

Change History

comment:1 Changed 6 years ago by gb

  • Status changed from new to assigned

You're right; this case (where the use of :CONC-NAME would create a duplicate accessor for an inherited slot) is covered in the last paragraph of the discussion of the :CONC-NAME option in the entry for DEFSTRUCT. COMPILE-FILE's warning about a duplicate definition that shouldn't have been generated.

comment:2 Changed 6 years ago by rme

  • Keywords defstruct added

comment:3 Changed 5 years ago by rme

We no longer warn about this, but we still appear to generate an item-x accessor when defining sub-item.

comment:4 Changed 5 years ago by rme

  • Version set to trunk

(my earlier comment about no longer warning about this is wrong.)

From  http://clozure.com/pipermail/openmcl-devel/2009-October/010668.html

Compiling a file with the following contents, both with 1.3 and with trunk (r12863):

 (defstruct foo
   (bar nil))

 (defstruct (foo1 (:conc-name foo-) (:include foo (bar t)))
   (frob nil))

generates a full warning about a duplicate definition of foo-bar within the same file. However, the second defstruct should not generate a definition of foo-bar at all, because foo-bar is already a reader for the bar slot in the (inherited) structure foo. (See the last paragraph of the :conc-name section in CLHS defstruct).

comment:5 Changed 5 years ago by rme

  • Milestone set to Clozure CL 1.5

comment:6 Changed 4 years ago by rme

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

comment:7 Changed 4 years ago by rme

  • Status changed from new to assigned

comment:8 Changed 4 years ago by rme

(In [13590]) Don't generate duplicate accessors for inherited slots. (See ticket:390)

comment:9 Changed 4 years ago by rme

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.