[Python-ideas] [Wild Idea] Static Ducks

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 20 09:21:45 CEST 2009


Talin wrote:
> the existing languages that 
> support static typing were misusing it - that is, in most languages 
> static typing is used to enforce consistency (the advantage of which has 
> been much debated) as opposed to making the language easier and more 
> expressive.

That's one side of it. The other side is giving the compiler
enough information about what you're trying to do that it
can generate safe and efficient code to do it.

> So I set out to build that language, and along the way I would fix a 
> number of other issues in Python, as well as the many issues I have with 
> Java, C++, C#, D, Ruby, and so on. And also incorporate a few of the 
> ideas which have been suggested on this list and others.

This sounds interesting. Would you mind sharing some of the
ideas you have about how to improve on the way previous
languages have used static typing?

Also I notice that all the languages you mention are imperative
ones. Have you looked at languages such as Haskell which use
type inferencing? Is there anything we can learn from that
camp?

(My experiences with type inferencing suggest that it's fine
up to a point, but you really need to insert explicit type
declarations at some key points, otherwise it becomes too
difficult to track down where type errors are coming from.)

I've also been grappling with static vs. dynamic typing
issues to some extent while developing Pyrex. Having an
essentially dynamically typed language that allows static
declarations where desired for efficiency seems to be
a very powerful idea. Cython seems to be heading in that
direction with the ability to add supplemental declarations
to otherwise pure Python code.

-- 
Greg



More information about the Python-ideas mailing list