Ticket #2 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

DEF-FOREIGN-TYPE, "auxiliary" foreign types, side-effects

Reported by: gb Owned by: gb
Priority: major Milestone:
Component: Foreign Function Interface Version: 1.1
Keywords: Cc:

Description

In trying to fix some issues related to how DEF-FOREIGN-TYPE and PARSE-FOREIGN-TYPE deal with "auxiliary" foreign types (e.g., record types), I've introduced a bug wherein some of the target-specific foreign types defined via INSTALL-STANDARD-FOREIGN-TYPES are only defined at compile-time.

One symptom of this is that it isn't possible to compile "lib/db-io.lisp" unless "lib/foreign-types.lisp" has been compiled in the same session; in other words, the load-time effect of defining things like (:STRUCT :CDB-DATUM) doesn't take place.

The whole concept of "auxiliary" foreign types is questionable, and the current foreign type system code applies it too broadly. Something like:

(DEF-FOREIGN-TYPE NIL (:STRUCT FOO (:X :INT)))

should always globally define or redefine the structure-type :FOO, and in something like:

(DEF-FOREIGN-TYPE NIL (:STRUCT :BAR (:A (:STRUCT :FOO))))

the inner reference to (not definition of) (:STRUCT :FOO) should be a (possibly forward-) reference to the globally visible structure type :FOO.

In a third case (should check a C reference), it is possible that in:

(DEF-FOREIGN-TYPE NIL (:STRUCT :BAZ (:A (:STRUCT :FOO (:X :DOUBLE))))

the internal definition of (:STRUCT :FOO) is local to the containing definition, in which case the FOREIGN-RECORD-TYPE for :BAZ would need to enumerate all such local ("auxiliary") structure and type definitions.

The old CMUCL type-system code (as it's been hacked up over the years) seems to want to treat all structure type definitions and references as if they were somehow local (to something ...), and attempting to fix this has introduced other problems.

Change History

comment:1 Changed 7 years ago by gb

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

The worst aspects of this seem to be fixed in 070408.

Note: See TracTickets for help on using tickets.