Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
PyAnnotate – Auto-generate type annotations for mypy
11–20 of 34 posts
Re: PyAnnotate – Auto-generate type annotations for mypy
#12Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
I somewhat agree but I think they will be optionally typed (and for that matter, optionally borrow checked), more along the lines of Julia. Where type stable code gets the performance benefits of static typing, even if it doesn't use any static typing. And where types can be added at any point to improve type checking, performance, and polymorphism all at once. This allows for fast prototyping, and when done correctl…
Re: PyAnnotate – Auto-generate type annotations for mypy
#13Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
No I think what we are seeing is a lot more hybrid systems. Go is like a statically typed language with lots of dynamic features. Julia is a dynamically typed language with lots static typing features. Paradigms are getting mixed too. Rust, Kotlin and Swift are all imperative languages with heavy functional inspiration. Traditional statically typed OOP languages such as Java is what people want to get away from.
I'm not sure why you started that sentence with "No". I actually agree with it.
There are many good ideas that have emerged separately in different languages, and are being combined in some of the new languages.
All I'm saying is, successful upcoming languages will probably be more statically typed than dynamically typed.
In other words, the dynamic typing paradigm is failing the real world test.
> Go is like a statically typed language with lots of dynamic features.
Go is statically typed.
The part that lacks static typing (no generics) is the worst part of the language that gets the most flak.
> Traditional statically typed OOP languages such as Java is what people want to get away from.
Java's problem is that it's just way too verbose.
User user = new User(....); // This is not even that verbose
// Maybe more like this:
User user = new User(new UserProfile(....), UserManagerFactory.getDefaultUserManager());
People have misdiagnosed the problem and thought it was the static typing.It turns out to be the lack of support for functions as objects. So for many things you end up having to create dummy classes and objects just to wrap functions.
Even C supported passing function pointers around.
So in this regard, Java is less expressive than C.
Re: PyAnnotate – Auto-generate type annotations for mypy
#14For any dropboxers (or others), how does this compare with pytype? https://github.com/google/pytype .
(work for Google and uses pytype daily) Pytype is similar to mypy that it can do type checking with proper annotations. In addition to use annotations, pytype can also do inference based on static analysis. I don't have much experience with mypy but the last time I used it, it cannot infer from `return x == y` that the function returns a bool. Pytype can correctly infer many simple forms of function argument types an…
Re: PyAnnotate – Auto-generate type annotations for mypy
#15Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
Anecdotally, I've developed large projects in C++ and Java (I know, they're pretty lame static type systems -- but certainly the most popular static type systems) and also in Python and Clojure and I really haven't seen much benefit in static typing in regards to software defect rate or quality. Static typing make auto complete and refactoring tools easier, for sure, but it also slows down ease of experimentation (and writing generic code can be painful, although other static languages especially type inferred ones fare better here). I buy into Rich Hickeys view on this topic[1] and that's one reason why I like Clojure: it gets out of the way, but it provides me with the tools I need to verify or validate my data (eg on the module or application boundaries).
I've played around with languages that have fancier type systems (Haskell, various ML's, briefly ATS) and am very interested in Rust (but have yet to use it), but they haven't really provided enough benefits for the effort of describing the types.
Note that I used to be very heavily in the static typing camp and I still very much like the idea of static typing, I just don't think we have found a static type system yet that has the right balance of convenience and safety and actually catches the right kinds of errors (as described in the below talk).
I guess my point is that its not quite clear that the next generation of successful languages will all be statically typed. In fact, current trends would suggest otherwise (most of the popular languages are dynamically typed) although perhaps that depends on your definition of "successful".
Re: PyAnnotate – Auto-generate type annotations for mypy
#16Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
Citation needed? Anecdotally, I've developed large projects in C++ and Java (I know, they're pretty lame static type systems -- but certainly the most popular static type systems) and also in Python and Clojure and I really haven't seen much benefit in static typing in regards to software defect rate or quality. Static typing make auto complete and refactoring tools easier, for sure, but it also slows down ease of ex…
Hold it right there. I've never seen anyone argue that static type systems prevent bugs.
I mean they do prevent silly bugs that occur from mistyping variable/property names but I've never seen anyone claim that they eliminate other classes of bugs.
The biggest benefit of static type checking is you know what all the variables are.
def checkout_cart(customer, payment_methods, cart, session):
# body
What the hell is customer? What is payment methods? What fields are available on these objects? What methods can you call on them? no freaking idea.Of course, this kind of code is confusing in Java as well, but for a different reason: Java conventions encourage a kind of obtuse programming style where everything is hidden behind layers of abstractions of factories and managers, so that even when everything is typed, you're not sure what anything is doing because all the data that matters is private and so are all the methods that actually do anything useful. All you're left with is an abstract interface that can sometimes be just as bad as an untyped variable. But this is mostly a cultural problem. (I've digressed).
> Static typing make auto complete and refactoring tools easier, for sure, but it also slows down ease of experimentation
Java slows down ease of experimentation because it requires tons of boilerplate code for even the simplest tasks.
It's not the static type checking.
If anything, static type checking helps experimentation because you can change your mind quickly and the compiler will help you catch all the stupid mistakes that can occur from mismatching types or mistyping variable names. This removes a huge cognitive tax and makes programming more enjoyable. Although I will concede this is subjective.
Re: PyAnnotate – Auto-generate type annotations for mypy
#17Earlier quoted context omitted.
Citation needed? Anecdotally, I've developed large projects in C++ and Java (I know, they're pretty lame static type systems -- but certainly the most popular static type systems) and also in Python and Clojure and I really haven't seen much benefit in static typing in regards to software defect rate or quality. Static typing make auto complete and refactoring tools easier, for sure, but it also slows down ease of ex…
> I really haven't seen much benefit in static typing in regards to software defect rate or quality Hold it right there. I've never seen anyone argue that static type systems prevent bugs. I mean they do prevent silly bugs that occur from mistyping variable/property names but I've never seen anyone claim that they eliminate other classes of bugs. The biggest benefit of static type checking is you know what all the va…
Really? I see this every single time the subject is brought up. And, to be fair, they do catch some bugs, it's just that they do so at a cost.
>What the hell is customer? What is payment methods? What fields are available on these objects? What methods can you call on them? no freaking idea.
And, if they are all strings, how much more of an idea do you have?
Static typing does not necessarily help solve this problem - a combination of reduced scope(i.e. looser coupling), more specific variable naming and higher cohesion (e.g. having a customer object) do.
Moreover, there's a super easy way to figure out what all of those things are and figure out how you want to change it - run a behavioral test and launch a REPL when it hits that function.
At that point you can inspect customer, use autocomplete on it and even experimentally run code.
>If anything, static type checking helps experimentation because you can change your mind quickly and the compiler will help you catch all the stupid mistakes that can occur from mismatching types or mistyping variable names. This removes a huge cognitive tax and makes programming more enjoyable.
Behavioral tests perform this function equally well, if you have them.
Re: PyAnnotate – Auto-generate type annotations for mypy
#18Earlier quoted context omitted.
> I really haven't seen much benefit in static typing in regards to software defect rate or quality Hold it right there. I've never seen anyone argue that static type systems prevent bugs. I mean they do prevent silly bugs that occur from mistyping variable/property names but I've never seen anyone claim that they eliminate other classes of bugs. The biggest benefit of static type checking is you know what all the va…
>Hold it right there. I've never seen anyone argue that static type systems prevent bugs. Really? I see this every single time the subject is brought up. And, to be fair, they do catch some bugs, it's just that they do so at a cost. >What the hell is customer? What is payment methods? What fields are available on these objects? What methods can you call on them? no freaking idea. And, if they are all strings, how muc…
I think a common pitfall in these discussions is to compare the worst case examples rather than reasonable quality codebases. I'd be far more interested in, say, time/cost to correct result metrics for a well-maintained Python codebase which has reasonable use of tests & linting (e.g. flake8) to an equivalently-proficient team using a statically typed language.
Re: PyAnnotate – Auto-generate type annotations for mypy
#19Earlier quoted context omitted.
> I really haven't seen much benefit in static typing in regards to software defect rate or quality Hold it right there. I've never seen anyone argue that static type systems prevent bugs. I mean they do prevent silly bugs that occur from mistyping variable/property names but I've never seen anyone claim that they eliminate other classes of bugs. The biggest benefit of static type checking is you know what all the va…
>Hold it right there. I've never seen anyone argue that static type systems prevent bugs. Really? I see this every single time the subject is brought up. And, to be fair, they do catch some bugs, it's just that they do so at a cost. >What the hell is customer? What is payment methods? What fields are available on these objects? What methods can you call on them? no freaking idea. And, if they are all strings, how muc…
If declaring structs is seen as costly overhead that complicates coding, tests are when more cumbersome.
Re: PyAnnotate – Auto-generate type annotations for mypy
#20Somewhat off topic but I think that more and more people are learning (the hard way, unfortunately) how important static typing is, and how dynamic typing makes it very difficult to develop and maintain large projects. I think the next generation of successful languages will all be statically typed (whether they will run natively or in a virtual machine is a different (even if related) question).
Citation needed? Anecdotally, I've developed large projects in C++ and Java (I know, they're pretty lame static type systems -- but certainly the most popular static type systems) and also in Python and Clojure and I really haven't seen much benefit in static typing in regards to software defect rate or quality. Static typing make auto complete and refactoring tools easier, for sure, but it also slows down ease of ex…
"Please don't be an uninformed Rich Hickey talk"
"Oh, it's an uninformed Rich Hickey talk"