[plt-scheme] type of language

From: YC (yinso.chen at gmail.com)
Date: Thu Dec 10 02:43:49 EST 2009

It just so happens that I am currently reading Real World Haskell, which has
the following to say about types (excerpts from
http://book.realworldhaskell.org/read/types-and-functions.html):

When we say that Haskell has a *strong* type system, we mean that the type
system guarantees that a program cannot contain certain kinds of errors.

In academic computer science, the meanings of “strong” and “weak” have a
narrowly technical meaning: strength refers to *how permissive* a type
system is. A weaker type system treats more expressions as valid than a
stronger type system.

Having a *static* type system means that the compiler knows the type of
every value and expression at compile time, before any code is executed.

Not to say they are right or wrong, but just another explanation.
Cheers,
yc

On Wed, Dec 9, 2009 at 11:17 PM, Marek Kubica <marek at xivilization.net>wrote:

> Hi,
>
> On Wed, 9 Dec 2009 16:09:15 -0800
> John Clements <clements at brinckerhoff.org> wrote:
>
> > > 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.
>
> Ok, what would be a better definition?
>
> > > 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.
> >
> > 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.
>
> I don't see how a clear distinction between these two would not be
> possible. Care to provide an example?
>
> regards,
> Marek
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091209/3695878f/attachment.html>

Posted on the users mailing list.