[ clocc-Bugs-1743120 ] TABLE Definition in DATA.Lisp

"SourceForge.net" <[email protected]> Mon, 25 Jun 2007 13:31:35 -0700
Newsgroups gmane.lisp.clocc.devel
Message-ID <[email protected]>
Bugs item #1743120, was opened at 2007-06-25 20:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101802&aid=1743120&group_id=1802

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: cllib
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Aneil Mallavarapu (amallavarapu)
Assigned to: Sam Steingold (sds)
Summary: TABLE Definition in DATA.Lisp

Initial Comment:
This continues a closed ticket: https://sourceforge.net/tracker/?func=detail&atid=101802&aid=1740662&group_id=1802 

Hi Sam - LW compiles your example code with only some warnings.

(defstruct genus
 (family nil :type family)
 (species nil :type (list specie)))
(defstruct family
 (order nil :type order)
 (geni nil :type (list genus)))
(defstruct genus
 (families nil :type (list family)))

However, it is not happy with both the STAT-COLUMN PRINT-OBJECT method and ENSURE-LEVELS, which both appear before the TABLE struct definition, and which contain calls to the typed slot reader SC-TABLE.

The CLHS states that the slot type option in defstruct must be a valid type specifier:

"This specifies that the contents of the slot is always of type type. This is entirely analogous to the declaration of a variable or function; it effectively declares the result type of the reader function. It is implementation-dependent whether the type is checked when initializing a slot or when assigning to it. Type is not evaluated; IT MUST BE A VALID TYPE SPECIFIER."
(emphasis mine)

By this strict definition, at the time that (DEFSTRUCT TABLE...) is evaluated this is not true.  Nonetheless, Lispworks is OK with it.  However, when LW tries to compile the PRINT-OBJECT and ENSURE-LEVELS bodies it gives the error.  This seems reasonable since the compiler needs to know the result type of the slot reader function at this point in compile time so it can perform the necessary optimization(s).  This kind of optimization is the sole use of the slot type, so it seems that Lispworks' implementation is in line with the word and intent of the CLHS.

Aneil

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=101802&aid=1743120&group_id=1802

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/