3 ms·
> in many statically typed languages this involves bitwise operators, lots of boilerplate, and mental hoops to adapt to an API 50 years old. Bitstring in OCaml
by yawaramin 6y ago
> in many statically typed languages this involves bitwise operators, lots of boilerplate, and mental hoops to adapt to an API 50 years old.
Bitstring in OCaml: https://bitstring.software/ https://bitstring.software/
Just as simple as in Erlang.
> I know for a fact that static typed languages don't help that much.
How do you know this?
> We all know that static typed languages are harder to learn and master
Again–how do you know this?
> Erlang has int (arbitrary length, like in real life) and floats. It is definitely easier.
OCaml has int and float, simple.
> We've all seen companies like Github, Twitter, Airbnb, born because Ruby on Rails exists.
These companies are now using Haskell, Scala, TypeScript.
> Facebook was written in PHP.
Fb created Hack, a statically-typed language that compiles to PHP. It has at least two other static-typing language compilers.
> Rust creates incredibly fast code, it has an incredibly slow compiler.
Is this proving something?
> Did you have this problem recently?
Yes–I and many others have this problem constantly, because we are mostly paid to work on existing codebases, not throwaway scripts.
> Of course the answer is "this is the programmers fault", but if it's wrong, why is it allowed?
Why is it allowed in dynamically-typed languages? Because it's useful. Same reason.
> Types are harder to understand and to correctly plan ahead for.
Types are not unchangeable; the whole point is that you can safely change code that has a typing discipline.
> it takes a great programmer to use types correctly in a way that others will comprehend without prior knowledge of the domain.
Then it must take an incredible programmer to maintain a dynamically-typed codebase.
- romanoderoma 6y ago> Bitstring in OCaml: https://bitstring.software/ https://bitstring.software/ Nobody has ever criticized Ocaml here You are proving my point: pattern matching can bring you far without the need for types >> I know for a fact that static typed languages don't help that much. > How do you know this? Why, in you opinion, hardcore statically typed languages have all, over time, imlpemente some form of type inference? Even C++ has type inference now. There must be a reason why... but I don' t know what it is. Let's review a bit of history together, shall we? From day one, C++ had magic. Dark witchcraft: destructors. Suddenly the compiler was doing things on its own. It also had type inference very early on, __but the developers of the mid-80s were not quite ready for that__ and Bjarne Stroustrup was pressured into removing auto, until it was added back to C++11. People nowadays wants safety of statically typed languages, but don' t want to type them. Back then if you were using languages without explicit types, you weren't a "real programmer". That's the only reason we have more C++ than Ocaml. I remember how it was. > These companies are now using Haskell, Scala, TypeScript. They are also using Lisp, Smalltalk, Perl, Erlang, Rust, Ruby (Github is still mainly a Ruby app). And Python, don' t forget the ton of Python they use. So what? > Yes–I and many others have this problem constantly, because we are mostly paid to work on existing codebases, not throwaway scripts. Well, if you are disciplined when writing types, why aren't you when refactoring? I work on codebases that are already 6 or 7 years old and have been re-written from scratch in new languages. It's just a mental model, none is inherently superior. It's the same thing you said about casting everything to Object, why do we need to change every function when refactoring? It's more useful if you don' t have to, unless it' s strictly necessary (i.e. the type behaviour has changed). > Fb created Hack, a statically-typed language that compiles to PHP. It has at least two other static-typing language compilers. because they are FB are you FB? I wish I had their problems Are you really saying that what FB does applies to the general population? Besides, when FB created hack PHP was 10 times slower than today. >> Rust creates incredibly fast code, it has an incredibly slow compiler. > Is this proving something? That there are always trade offs, for example? > Types are not unchangeable; the whole point is that you can safely change code that has a typing discipline. nobody will ever admit how much work it takes to having typing discipline. because it's part of the deal, it's hard, but rewarding, it immediately bring you on top of the food chain. you know the secret of steel. on the other side, nobody wants to use discipline when using not statically typed languages. and just scoff on the language when they forget to change a few function signatures (THOU SHALT NOT FIX CODE BY HAND). > Then it must take an incredible programmer to maintain a dynamically-typed codebase. It requires the same discipline that won't let you forget you had an appointment with the dentist. Everyone can have it. It's not an art for initiated, it's simply being routinely organized.