New is out and the only thing people want to talk about is more types, and "when types become mandatory"…

Having lived through the delusion of OOP I'm looking at type checking and see that it's no different. We will spend years on putting all that new stuff in our code until we realize it didn't make our programs any more correct. And the answer is not "smarter types", by the way.

· · Web · 3 · 1 · 4

@isagalaev Agree. I breathed the fresh air of after a decade in the C++ barns .. There may be a place for enforced types, but I don't think they should be mandatory

@meejah @isagalaev I remain confident in my ability to write shit code in a variety of formats, using any paradigm you care to enforce, thank-you-very-much. Type checking? *cracks knuckles* hold my int.

@meejah in my limited experience it's probably down to some specific domains. And I don't really know where type checking may be useful. What I do know is in back end and front end Web the overwhelming majority of program defects don't come from wrong types.

@isagalaev Typing hints in Python are nice though, it's entirely up to you to used them or not.
My (strongly coloured) view is that explicit types are nice as documentation.
What do you mean by "smarter types"? Is this a term in the Python world?

@wim_v12e unfortunately it's not entirely up to me. If I'm using a library with them, I have to read them. But what's worse is that using types encourages bad architecture: every piece of data is declared as an opaque custom type, there's a lot of dependency injection and inversion of control. People basically start writing Java in Python syntax. And I have to deal with it.

So no, it's not ignorable.

@isagalaev I guess you mean that if a library uses them, you have to as well?

I'm a bit confused as you refer to Java, and that is OO, and Python already has OO without the type hints. I'm not sure what you mean by an opaque type, I didn't know Python has them and I couldn't find any info. What are they?

@isagalaev types are useful only for massive projects and easier introspection. There are a number of cases where you can catch minor bugs, but it's more than likely it's just useful for doing things like API generation.

Obviously if types were the answer there would be no bugs in strongly bound languages.

I see them closer to rust types: declare what they should be but they can be something else later.

In Rusts case the compiler enforces declarations.

@ketmorco I mostly agree!

However when hear the "big projects" argument my immediate reaction is, better invest in loosening coupling in that project and making it simpler. We already have a mechanism for it, functional and modular abstraction. If you feel like you're having no idea what calls what and what kind of arguments your functions accept, that that's the problem. Adding types may alleviate it for a while, but it's just fighting symptoms.

@isagalaev I don't necessarily mean a tightly coupled project, or even a monolith.

Google is a good example - it's huge and there's a lot of reasons you'll want to consume bits that you have zero control over. Types help there!

But they only help. Still have to address correctness holistically.

@ketmorco I'm with Rich Hickey here, though: it's names that are important, not types necessarily. "endpoint_url" tells me everything about some piece of data, while "string" tells pretty much nothing.

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!