[plt-scheme] Typed scheme: Cannot apply expression of type Procedure, since it is not a function type

From: keydana at gmx.de (keydana at gmx.de)
Date: Wed Jun 2 16:32:15 EDT 2010

> 
> Notice that our code will type check perfectly but every expression
> has type Any and these types are essentially useless. This gives you
> an idea of what static typing does and doesn't check. Basically types
> are statically checked, but cases (in the discriminated union sense)
> aren't. Cases are how you inject dynamic checks into statically typed
> languages. 


Yes, I think I see what you mean... the discriminated union cases in a way threaten to "dissolve" the type system...

In fact, it seems to me I'm approaching this from the opposite angle somehow: Taking standard dynamic scheme as the default, I use typed scheme primarily for "educational" purposes - I like being forced to think about how, exactly, the fields of a record (for example) are defined or what exactly a function has to accept/return.
But even more, I like using the discriminated unions (with the define-datatype macro), they make me think about what "kinds of a thing there are", and they offer an easy way of structuring the code (I'll just have to handle every case and that's it).
Certainly this also depends on the domain - in my case currently, discriminated unions seem like a very suitable way to implement something "language-like" (the discriminated unions looking like some semantic equivalent of BNF anyway).
On the other hand, they really get inconvenient when there's too much pattern matching to do (speaking of pattern matching, their "natural proneness" to be used with pattern matching - if I my say so - is another reason I like them so much...)

- All this just from the perspective of a "normal user" (well in the end, I should perhaps also admit that using the algebraic datatypes in typed scheme might be a way of coping with the sad fact that my spare time doesn't  seem sufficient to learn/practice both scheme and haskell :-;)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100602/fccf54b6/attachment.html>

Posted on the users mailing list.