December 2008
  Sun Mon Tue Wed Thu Fri Sat  
    1 2 3 4 5 6  
  7 8 9 10 11 12 13  
  14 15 16 17 18 19 20  
  21 22 23 24 25 26 27  
  28 29 30 31        

Archives

November 2009 (2)
September 2009 (1)
July 2009 (2)
June 2009 (1)
March 2009 (3)
February 2009 (3)
January 2009 (3)
December 2008 (1)
November 2008 (1)
October 2008 (2)
September 2008 (7)
July 2008 (5)
June 2008 (1)
May 2008 (3)
April 2008 (4)
March 2008 (3)
February 2008 (3)
January 2008 (1)

December 7, 2008

Programming languages. Second part.

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.

Published at 11:34 / 0 comments / 113 visits
This post is public

( 1 post )

 

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