On 28/01/2015 15:04, Mario Figueiredo wrote:
In article <54c83ab4$0$12982$c3e8da3$54964...@news.astraweb.com>,
steve+comp.lang.pyt...@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.

C and C++ are weakly and statically typed languages. Python is a strongly and dynamically typed language. Therefore anything following based on the above paragraph alone is wrong.


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.



--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to