4 ms·
> [...] before you know it all "serious codebases" will be statically typed. And this is bad because...?
by dozzie 10y ago
> [...] before you know it all "serious codebases" will be statically typed.
And this is bad because...?
- toyg 10y agobecause they will lose readability and raise the bar for contribution from novices. Every extra feature you add to the language requires extra effort to read and extra effort from novices to understand.
- dozzie 10y ago>>> [...] before you know it all "serious codebases" will be statically typed. > because they will lose readability and raise the bar for contribution from novices OK, hold for a second. Adding something to make the code easier to follow will make code harder to follow? Is this really your argument? And why would a novice to a language want to contribute to "serious codebase"? I don't think Django, Jinja, or NumPy are popular for Python novices to contribute code.
- yedpodtrzitko 10y ago"Readability" depends on a context. I've worked with a huge codebases where having a variable types attached to the variables there would actually improve the readability. Sure, it would take you a moment longer to skim the line, but overall it would save you a much more time to figure out what's the variable about.
- singhblom 10y agoI don't know about this. My feeling from working with Typescript and Javascript is that the type hints really help people understand what is happening. My background is as a Python programmer, but Typescript really convinced me that optional type hints are a super-valuable addition to a dynamic language. Most of my docstrings in python tend to be type annotations anyway -- might as well make it possible for tools to support it easily.
- 2T1Qka0rEiPr 10y ago@dozzie, I don't think static typing does make it easier to read, it makes it more verbose.
- catnaroek 10y agoAre you confusing “static typing” with “type annotations”? You can write large swathes of statically typed code without a single type annotation, in languages with proper type inference. This is 70's-era technology, mind you.
- 2T1Qka0rEiPr 10y agoYou're right, I'm conflating the two, though I appreciate that one doesn't require the other.
- raverbashing 10y agoAnd this is good because? You want Java you use Java. Oh it sucks? I wonder why... Oh even better, you set a type, does it prevent you from using things with a similar interface? Like iterables in place of lists?
- dozzie 10y ago> And this is good because? Better code documentation? Static analysis? Compare to Erlang with typespecs and Dialyzer. > You want Java you use Java. Why Java? Why not SML, OCaml, Haskell, Rust? Those are statically typed languages, too. > Oh it [Java] sucks? I wonder why... Because it's statically typed yet it's dynamically typed ("Object" class thing)? Because its type system is quite primitive and somewhat inconsent? Because it was designed for use in TV sets two dozens years ago, and has barely advanced as a language since then? (No, foreach loops and lambdas don't qualify as a significant step, those are merely syntax sugar.) > Oh even better, you set a type, does it prevent you from using things with a similar interface? Like iterables in place of lists? Type specification signifies code author's intent. This is a very good thing, and I want to see it much more in the code. I don't expect type specs/hints to do anything more for a dynamically typed language.
- raverbashing 10y ago> Haskell, Rust? Those are statically typed languages, too. Developers on those languages usually don't push for crap like the Java developers do And I don't want to use Rust or Haskell where Python can solve the problem just fine. Overhead and development time is also a problem Type hints add development time and bureaucracy. The 80 columns limit was supposed to be a guidance as well but now it has become almost mandatory
- pjmlp 10y ago> The 80 columns limit was supposed to be a guidance as well but now it has become almost mandatory Only for those whose pinnacle of programming editors are from a VT-100 era.