Friday, December 29, 2006

The immutable law of scripting languages

Why is it that everyone who designs a scripting language appears to believe that it is necessary to eliminate type checking?

Type checking and array bounds checking are two of the most powerful tools in the programmer's arsenal. Using them makes it easier, not harder to write code that works.

At the current time roughly 70% of all coding is done using three languages that are essentially identical in terms of syntax: JavaScript, Java and C#. They are almost but not quite the same and the 'not quite' part leads to endless problems.

Python has many of the features I would want in a programming language (especially indent delimited structures) but it tends to get overlooked as a result of the functional programming features.

All a programming language is is a set of high level abstractions that allow someone to get to grips with a low level machine code. Why can't we get rid of the idea that the coder of an application gets to choose the scripting language that people will use to program in it? Why can't I use python (or for that matter C#) to code extensions for Mozilla with the same ease as the hideous JavaScript?

1 comment:

Paddy3118 said...

Type checking usually restricts a variable to hold values of only one type. This would restrict a Dynamic language like Python where, for example, I can define a function to multiply something by 3 and it will work for any object that works with the multiply operator and the integer 3

def times3(x):
return x * 3


What should the type of x be?

I can do:
times3(6) --> 18
times3(6.0) --> 18.0
times3(6+0j) --> (18+0j)
times3("abc") --> 'abcabcabc'

Optional typing IS being considered for future Python versions though, as it is is a good compromise between flexibility and allowing Python to be compiled to machine-code.

- Paddy.