[racket] Why not use a typed language for HtDP?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Aug 24 08:06:39 EDT 2013

The goal of HtDP is to teach design principles in such a way that they apply to programming in a whole range of languages: 
 -- explicitly statically typed 
 -- statically typed with inference 
 -- "dynamically typed" scripting languages 
 -- probably not as much to unsoundly typed languages (C, C++) or untyped languages (ASM) but even there 

Say you design an XML walker in Python. You should really understand the data definition of your chosen XML representation and use a program organization that maps to this data representation. I maintain that the person who maintains your code will greatly appreciate it if you know how to document the data representation choice even if it is not checked. 

Also, it turns out that languages provide horrible feedback to beginners because their error messages assume programmers know the whole language. The problem is solvable for the dynamic aspects of languages but remains to be solved for the static (type) aspects. (When we started, suitably useful PLs used type inference and provided the worst possible feedback when inference discovered an error. Now they signal second-worst feedback but nobody knows who's worst.) 


We picked the full language that we thought offers a decent goal (Racket) and developed teaching languages that gradually approximate the language but provide good feedback. 

-- Matthias

On Aug 24, 2013, at 4:38 AM, Ben Duan wrote:

> Dear All,
> Here’s a beginner's question about How to Design Programs.
> HtDP puts great emphasizes on data, and it forces the reader to think about data types by writing signatures. Then what not use a typed language so that it is forced by the language itself? Or did I misunderstand the purpose of the authors?
> Thanks and regards,
> Ben
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Posted on the users mailing list.