3 ms·
> I don't understand, why people are so dogmatic about static typing. Most static typing folks have backgrounds in dynamically typed languages, and it's this e
by throwaway894345 5y ago
> I don't understand, why people are so dogmatic about static typing.
Most static typing folks have backgrounds in dynamically typed languages, and it's this experience (not dogma) that informs their preferences. The inverse (people have extensive experience with statically typed languages but developed a strong preference for dynamically typed languages) seems far rarer, at least nowadays where the canonical statically typed language is not C++.
Personally, I think one of the killer features of statically typed languages is that they make it difficult for people to write code for which the types would be very convoluted. In other words, statically typed languages provide rails which guide poor developers toward better habits (and incidentally, these same rails make it very painful to port a lot of JavaScript to TypeScript or for many JavaScript/Python developers to use statically typed languages).
From my understanding, the lisp language communities tend to select for programmers who have good habits already so they probably don't benefit from this property as much as other dynamic languages. Similarly, lisp programmers can use metaprogramming without it turning into a complete shit show, which is what almost invariably happens whenever Python programmers start dabbling in the metaprogramming facilities of their language.
That said, there are other advantages to static typing besides preventing classes of errors. For example, a lot of important documentation is generated and guaranteed by the type system. A perennial problem in dynamic languages including lisps is documenting the types. If you say something is a "file-like" object, what does that mean? Does the callee require that the object has a read() method, or does it also need seek(), close(), etc? And very often you don't even get "file-like object" but rather just a terse variable name (lisps are especially guilty of this, in my experience) or the documented type is outright incorrect (typically someone changed the code but didn't update the documentation). Additionally, you get a lot more powerful tooling, because the types can be reasoned about statically (which isn't to say Closure lacks powerful tooling, but rather that its tooling is powerful in spite of dynamic typing).
- kaliszad 5y agoWell, a considerable number of people in the Clojure programming community are often people, who developed in Java or C++ for one or two decades and sometimes people how have to switch between several languages. Most that I have talked to love Clojure above all else and can see the things not contributing to the solution of the problem at hand. Static types are at the top of the list of things that contribute almost nil and cause a huge amount of development overhead everywhere. It sometimes seems in these advanced languages, static types are there so the programmer makes the job of a compiler (easier) or that you can write an academic paper, where static typing is almost a must to get it into a journal for some reason. My colleague gave a really in depth talk/ Q&A about Clojure and touched on static types at length. I think, it could be interesting for you: https://www.youtube.com/watch?v=4UoIfeb31UU https://www.youtube.com/watch?v=4UoIfeb31UU
- throwaway894345 5y ago> who developed in Java or C++ for one or two decades Right, this is exactly my point. People think these languages (especially as they were a decade or two ago) are representative of statically typed languages. > Static types are at the top of the list of things that contribute almost nil and cause a huge amount of development overhead everywhere. This is your dogma, not an established fact. I'm glad you like Closure; no doubt it's a fun, useful language. It's probably even better than Java or C++ for many things. I'm only saying if you try different languages you might see that there are tradeoffs in features. You might still think Closure is the best, but you might at least understand why people appreciate static types.
- kaliszad 5y agoI have written some Haskell and I am quite certain, it is more practical for me to use Clojure. I know other people, who did compiler research (! see my points above about academic research) who rewrote the previous more or less exploratory Clojure solution in Haskell for better performance and other positive aspects. These are all good things. I also know about Facebook, Microsoft and other big companies using Haskell to great advantage. But the compiler e.g. is not something commercially applicable it is research, they don't have or want to sell it or make it a service. I also am not sure anybody would be interested to buy it, as they never told us about any practically applicable results (e.g. better parallelized HPC code) which was kind of the point of the research. I might be mistaken though. Anyway, the lecture and the exercises where rather good and even if it was the only thing that semester, it would justify the semester at the university for me.
- throwaway894345 5y ago> I have written some Haskell and I am quite certain, it is more practical for me to use Clojure. Certainly, but there are lots of factors beyond static types vs dynamic types. For real world projects, I might similarly use Python or JavaScript over Haskell because it will be easier to find developers, libraries, and tooling. That doesn't impugn static types, however (on the other hand, depending on the project, Haskell might be the better tool). Indeed, the type system is a relatively small, overemphasized facet of any programming language. See my comment here for elaboration: https://news.ycombinator.com/item?id=27784762 https://news.ycombinator.com/item?id=27784762