[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Types: bits vs messages




OK, here is a late follow on to the recent discussion on types.

How do you pragmatically resolve the difference between structure based types and message based types. (My apologies if my terminology is off.) Types in a language like C are all about structure: how many bits are there and how should they be interpreted (eg, IEEE floating point or two's complement)--or worse, C-strings whose type definition is a byte sequence with a final byte of \0. Types in a language like Smalltalk are all about messages: what messages does the object respond to.

How do theoretical type systems handle these two kinds of types? Can they be reconciled? Are there any type systems that try to verify things like: a C-string must have a \0 as its last byte and no where else in the sequence?

And does anyone have any experience/advice on how to handle these issues in practice? This is an area where object oriented laguages really seem to struggle. They want to define "type" as the set of messages an object can recieve, but they also want to interoperate with C-style APIs and OS interfaces. I have yet to see a satisfying integration of the two.

david

--
David Farber
dfarber@numenor.com