[plt-scheme] Re: plt-scheme type of language

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Dec 13 19:39:32 EST 2009

C's type system doesn't even predict the length of something if you
allow casts. Specifically you can say that a pointer to something can
be a pointer to anything else (even of different length) and the
dereference the pointer to get something with the wrong length.

This is actually widely used feature. For example, in MzScheme's
implementation you have the type Scheme_Object which I think is
something like a char or something small, but there are lots of other
C types that are just longer versions of that thing, and you look at
the value of the char to figure out which one you actually have (and
then do a cast to get the data in a convenient form).


On Sun, Dec 13, 2009 at 5:20 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> The explanation of C's type system explicitly states
> that types predict the number of bits allocated. If
> you take this seriously, the type system is "bits"
> and it's universal -- just like in plain Scheme, just
> a lower level.
> The problem with C++ is that it pretends to provide
> a lot more when it comes to types, and it all becomes
> gibberish.
> He was the wrong man at the right place ...
> On Dec 13, 2009, at 4:36 PM, hendrik at topoi.pooq.com wrote:
>> On Sun, Dec 13, 2009 at 04:02:30PM -0500, Matthias Felleisen wrote:
>>> So one can now say that C/C++ have a type system but it is
>>> unsound. It doesn't predict what happens at run-time. (They
>>> also have one that is sound but the normal programmer doesn't
>>> even perceive this system.)
>> What sound type system is this?  The one where everything has the type
>> "binary gibberish"?
>> -- hendrik
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.