34 ms·
People created dynamic languages for the exact reason of not having to define types. Now the trend is to bolt on type checking to dynamic languages because peo
by iamleppert 8y ago
People created dynamic languages for the exact reason of not having to define types.
Now the trend is to bolt on type checking to dynamic languages because people don’t want dynamic behavior. Most developers I’ve encountered who seek to add types to dynamic languages will never truly understand dynamic languages, closures, concurrency passing or functional programming for that matter.
If you want a statically typed language, use one. Use one that was designed for deterministic behavior and static correctness.
If you have a huge codebase in Ruby that is full of bugs and is unpredictable, don’t blame the language or lack of types.
There are plenty of ruby codebases that are bug free and work well without static typing. How do they exist?
- adamnemecek 8y ago> There are plenty of ruby codebases that are bug free and work well without static typing. How do they exist? This is a bad question. Refactoring Rails is AFAIK a nightmare. Given enough devs it can probably be done, however it might be painful.
- f00_ 8y agowhat's wrong with adding type hints in python? It's literally just a linting tool. It's jsut some extra documentation so someone can tell what types a function expects and what types it return. You can run something like mypy or pyre and you can have some static checking done on your code "will never truly understand dynamic languages, closures, concurrency passing or functional programming for that matter." you sound like a pompous cunt honestly
- Tehnix 8y ago> Most developers I’ve encountered who seek to add types to dynamic languages will never truly understand dynamic languages, closures, concurrency passing or functional programming for that matter. I don't see how seeking to add types precludes also understanding "closures, concurrency passing or functional programming", especially since these are in no way foreign concepts in statically typed languages. > If you want a statically typed language, use one. Use one that was designed for deterministic behavior and static correctness. I definitely see what you're trying to say, but as I understand it, these projects to "add types" often come on later, when the project is so big, that it is simply less time consuming to just develop a type checker, than it is to rewrite your entire codebase in a new language.
- iamleppert 8y agoMy argument is that you can always implement your own breed of type checking either via convention (with appropriate enforcement via static analysis or linting tools if so desired without having to run the code), or you can do type checking at run time -- most dynamic languages have a facility to interrogate a variable to determine its contents and you can implement any number of tests on it as you see fit to validate it.
- hderms 8y agoIn practice the difference in guarantees between a static type checking system and a runtime one are so vast that I think they're mostly incomparable. Runtime checking is like doing most of the work of modelling a program with static types but achieving a fraction of the benefit.
- Kiro 8y agoBut let's say you have a function that takes an integer and goes completely bonkers when you pass in a string. Why would you not want to prevent that?
- freedomben 8y agoI'm not sure how well you understand functional programming either if you think it needs dynamic typing. The king of functional programming languages (Haskell) is statically typed.
- iamleppert 8y agoThe king of functional languages is not Haskell but Lisp in my opinion, and Lisp is dynamically typed. With Common Lisp, there is no difference between runtime and compile time: it's one in the same.
- zxcvhjkl 8y ago> People created dynamic languages for the exact reason of not having to define types. Not having to define types is not the biggest merit of dynamic languages. The biggest benefit is to be able to do things that you couldn’t do if you had a type system. You can do some crazy stuff with Ruby’s meta programming.
- hderms 8y agoHow many problems out there are really apropriately solved by runtime metaprogramming?