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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Dec 11 10:45:05 EST 2009

On Dec 11, 2009, at 6:08 AM, keydana at gmx.de wrote:

> Regarding the former, I already would be in difficulty to say if I  
> may use it synonymously with "type soundness" (which is of course  
> defined before, but still I'm not sure :-;).
> Now when people "out there" talk about "strong typing", I understand  
> I'm supposed to say "that's the wrong question to ask", but for me  
> as a non-expert it will still be difficult to argue with them...

One answer is "I used to think like you, until I read this book that  
explained this really well. It's called PLAI, and it's freeware. Take  
a look. It changed my mind about this." If they probe, you can say  
that there are

  typed (ML) and untyped languages (Perl)
  sound (Haskell) and unsound type systems (Eiffel)
  (type and memory) safe (PLT Scheme) and unsafe languages (C)

and combinations that exist and those that can't exist. For example,  
it is impossible to have a sound type system w/o a safe run-time system.

> Instead, I'm tempted to equate it with the notion of "type safety",  
> but I'm not sure if it will work: I understand the problem of C  
> being the independence of the static and runtime type systems, but  
> then how about the PHP/Perl example of 1 + "1"...?

PHP/Perl are prefect examples of safe languages without a type system.  
Safety depends on two things:
  -- the input domains of computational primitives (function or method  
application, the addition function) are well-defined sets
  -- the memory is managed in a way that doesn't allow arbitrary bit  
pattern to be interpreted in conflict with the well-defined sets
In their case, + is defined as

   Number x Number -> Number
   Number x String -> String (I vaguely recall from my Ruby effort)

and that's a fine domain restriction. Presumably true + 'c' fails.

Posted on the users mailing list.