Black and White Rainbow Published on December 7, 2008
by Black and White Rainbow

Black and White Rainbow's blog

Browse posts
L'évolution d'internet...
Posted on February 7, 2009
Du groupe et des individus...
Posted on January 26, 2009
La limite du possible.
Posted on January 15, 2009
root sous Windows...
Posted on January 9, 2009
Programming languages. Second part.
Programming languages. First part.
Posted on November 24, 2008
Comment ne pas devenir pauvre.
Posted on October 29, 2008
Les côtes bretonnes et les nombres complexes.
Posted on October 18, 2008
AutoHotKey for coders.
Posted on September 29, 2008

More information

This post is public
Attribution + non Commercial + no Derivs
  1. Read 113 times

Programming languages. Second part.

Sunday December 7, 2008 at 11:34AM

In the introduction of first part I listed some way to differentiate programming languages (PLs for power-users). In this list was one of the most important distinction : the typing ! But what is the typing ? It has been underestimated for a very long time (in computer science, a very long time is way shorter than in history...) but it is the first step to make to approach secure programs (secure generally means bugproof).

For a turing-machine, speaking of typing has no sense (it only knows symbols we fill the alphabet with) ; the reason for that is not the "imperative" aspect of the machine but the programming language (ie the state transition function) being low-level (you actually read/write in memory blocks and moves the reading/writing part of the machine). In the other hand the lambda calculus being high level it has naturally been typed.

In real programming languages, there are different typing types (OK, this one's not really good...). It can be strong/weak, dynamic/static, eexxtteennssiibbllee/not, ...
The strength of a typing indicates if coder is really restricted or just guided by it. For those not used to it, strong typing can be seen as a very rigid restriction. It just force you to be explicit. In strong typing you have to change the type of variables/values (we'll get to this distinction later) explicitly
(in OCaml : let bool_of_int = function |0 -> false |_ -> true ;; makes the transition between an integer and a boolean, OCaml is strongly typed ;
in C char a='a' ; if(a){printf "%d"; atoi(a+2);} the typing is weaker, the variable a is used as a boolean value(if...), an integer (a+2) and a character (atoi))
.

At the beginning, when there was no typing, bugs where awfully powerful. With dynamic typing bugs are often (but not always) a cause of program interruption, type is checked when executing the program avoiding inconsistencies such as adding a character to a integer array. The static typing on the other hand is a typing that is checked while compiling (making a program out of a source code). It allow an early bug detection and rare interruption while running. It also is quicker when running.

Add your comment

Reply to this comment

Edit your comment

Please sign in to post a comment Sign in now?


rss Latest comments – Subscribe to the feed of comments related to this post.

 

Català | Čeština nové | 中文 | Deutsch | English | Español | Esperanto | Ελληνικά | Français | Galego | Italiano | Nederlands | Português | More...