[plt-scheme] type of language

From: hendrik at topoi.pooq.com (hendrik at topoi.pooq.com)
Date: Wed Dec 9 19:17:21 EST 2009

On Wed, Dec 09, 2009 at 04:09:15PM -0800, John Clements wrote:
> On Dec 9, 2009, at 3:17 PM, Marek Kubica wrote:
> > On Wed, 9 Dec 2009 18:14:11 +0200
> > emre berat nebioğlu <beratn at gmail.com> wrote:
> > 
> >> i guess become a Computer programmer or Computer Scientist  is not
> >> only about writing code but also it is about some specific stuff like
> >> type of language.
> > 
> > Well, the nice thing about such things is, that you can learn it and
> > classify a language yourself.
> > 
> > Weak/Strong typing: If a language is weakly typed, it tries to convert
> > the types automatically and guess what you want to do. For example,
> > consider "1" + 1. If a language is weakly typed, the answer is usually
> > 2 (or "11"), because it guessed what you wanted to do. If it is
> > strongly typed, you get an error/exception that this is not valid, one
> > cannot add a string and an integer together.
> > 
> > Popular example of weak typing: PHP
> > Popular example of strong typing: Scheme :)
> Ack! I totally reject this definition of "weak" vs. "strong" typing. Generally, the difference you're describing has nothing to do with the language's type system per se, but rather with the definition of its primitives, and how flexible or restrictive they are.

What I understand about the difference between weak and strong typing is 
whether the types leak -- whether there are language features that can 
easily cause a running program to violate the type system without it 
being the deliberate intention of the programmer to do so.  For example, 
C unions.

> > Dynamic/Static typing: is the type information enforced? Can a
> > "variable" change its type? Is it possible to call a function with
> > types that weren't considered by the implemnentor of the function?
> > Do you need to declare the types of function arguments and return
> > values?
> > 
> > Popular example of dynamic typing: Scheme :)
> > Popular example of static typing: Java
> > Popular example of static typing with type inference: ML
> > (type inference = you don't need to specify the types, the language
> > finds out about them by itself)
> Ack! I totally disagree with this as well.
> A statically-typed language is one with a built-in proof system that 
> demonstrates the impossibility of certain runtime errors.  These 
> languages refuse to run any programs for which their proof system 
> cannot construct such a proof.

A statically typed language is one in which the types of expressions 
and variables and such can be determined without running the program.  
It only manages to be a proof in the sense you describe if the type 
system is strong as well.

> The choice of *which* errors are fenced out by the proof system is up 
> to the designer of the type system, which makes clear distinctions 
> between statically-typed languages and non-statically-typed languages 
> impossible.
> Sorry to be such a disagreeable chap,
> John Clements

Posted on the users mailing list.