[PRL] the "success" of types

John Clements clements at brinckerhoff.org
Fri May 19 14:57:54 EDT 2006


On May 19, 2006, at 8:35 AM, Mitchell Wand wrote:

>
> But this has nothing to do with "functional programming."   It is  
> very clear that Floyd, Hoare, Dijkstra et al thought about  
> invariants as a way of managing the complexity of state in  
> imperative programs.  (and Floyd and McCarthy were both at  
> Stanford, if I remember correctly).
>
> Functional programming has to do with expressive mechanism   
> (remember, we are about *language*).   How do we specify the  
> channels?  Functional programming is one way of doing this; Java  
> and imperative programming are another.  Invariants (whether or not  
> they are expressed through types) are important for both, and we  
> shouldn't conflate the benefits of types/invariants with the  
> benefits of functional programming.


WARNING: the following synopsis is obvious to Very Smart People (tm).


If I understand Matthias correctly, then his claim is this:


1) both functional and imperative programs communicate values between  
different parts of the program.

2) in a functional style, this is generally done by passing a value  
to a function.  In an imperative style, this is often done by putting  
a value in an existing cell.

3) You can model functional languages using imperative languages if  
you see "passing a value" as "putting a value in a fresh cell."

BUT!

In this model, you get a short-lived cell for each parameter, rather  
than a long-lived existing cell as you might in an imperative language.


So what?


MF:  Well, type systems allow us to be much more specific about this  
shorter-lived cell (e.g., using parametric polymorphism).

MW: But invariants can play this same role in an imperative program.
(is this a correct reading)?

MF : But programmers are too lazy to write down such invariants  
unless they're forced to, and imperative languages make it easy to  
just assign a nice wide type to the cell and not worry about it. And  
that's why most of the recent work on types is motivated by  
functional programming languages.

End synopsis.

Is this a reasonable synopsis?


John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
Url : https://lists.ccs.neu.edu/pipermail/prl/attachments/20060519/aaef4d24/smime-0001.bin


More information about the PRL mailing list