Python is DOOMED! Again!

Mario Figueiredo marfig at gmail.com
Wed Jan 28 10:04:18 EST 2015


In article <54c83ab4$0$12982$c3e8da3$5496439d at news.astraweb.com>, 
steve+comp.lang.python at pearwood.info says...
> 
> Mario Figueiredo wrote:
> 
> > Static analysis cannot and should not clutter executable code.
> 
> (1) It isn't clutter. The human reader uses that information as well as the
> compiler, interpreter, type-checker, IDE, text editor, correctness tester,
> etc.
> 
> (2) Algol, Ada, Boo, C, C#, C++, Cobol, Cobra, D, F#, Fantom, Fortran, Go,
> Haskell, Java, Julia, Kotlin, Oberon, Pascal, Rust, Scala and dozens
> (hundreds?) of other languages disagree with you.
> 

Sorry. Somehow I missed this post. Only realized now from the Skip 
answer.

This is simply not true!

For most of the strongly typed languages (e.g. static typed languages) 
in that list -- C, C++, C# and Scala, the ones I know best from that 
list -- require little to no annotations in the code (and certainly no 
new explicit function or class based syntax) in order for static 
analysers to perform their thing, except perhaps on the most exotic 
static analysers. 

Being a strongly typed language, there is no need for added information 
in the function signatures. From that list you can safely exclude all 
strongly-typed languages.

For dynamically typed languages, what I have seen being implemented on 
almost all cases is doc-like features for type annotation. Of the list 
you provide (few there are dynamically typed, btw) Julia is the one I 
know of. Julia implements a similar type annotation to type annotations 
in Python. In fact I see a lot of Julia in PEP 484. But with different 
objectives:

    function add(a::Int, b::Int)
        a + b
    end  

Here the :: annotation is meant to attribute a type in an otherwise 
dynamically typed language and that function signature is executed at 
runtime with all the implications of a statically typed signature.

Static analysis in Julia admitedly can only be performed if those 
annotations are present, and of the entire list you provide this is the 
only example language that more closely matches your argument. The 
others simply are not true.

But in any case, in Julia type annotations, contrary to Python, are 
evaluated at runtime. It then makes all sense for them to coexist with 
the language syntax.



More information about the Python-list mailing list