re: What do you dislike about your favorite language? VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

FYI: there are indeed types existing in JavaScript.

Maybe you wanted to write “strong types,” but strong types are extremely overrated.

 

FYI: there are indeed types existing in JavaScript.

I know that very well. I was hoping that was clear enough... It wasn't the case, apparently 😕

strong types are extremely overrated.

"Extremely", really?
Look, I really like JavaScript and I generally don't mind the lack of typed variables, but a tool for static analysis is indeed quite handy.
Not to mention that with strong types the code can be more easily optimized by the engine, saving a lot of euristic work by the compilers.

A gentle introduction to typed variables as it's done in TypeScript would be great in that sense.

 

Strong typing can help minimize or eliminate whole hosts of errors at compile time, as opposed to type-based errors rearing their ugly heads only during testing and production. Things like clojure.spec and TypeScript are a good segue between strong/weak typing. As someone who is functionally inclined, I would imagine you've read some of the reasons that Idris and Haskell were created.

Haskell was created as an open-source standard for purely functional programming languages. Idris, in turn, was created because Haskell never succeeded to prove it might be used outside of the academia (well, I exaggerate it a bit.) Also, Idris has dependent types, which is far more useful than just static strong types.

I never said strong typing is bad. It is good, to some extent. It is not a panacea nor a silver bullet to make the code error-prone all of a sudden. It could help sometimes. It might make a development process a disaster (think of the boilerplate of types needed in Haskell to just start coding a simple web service.)

I am positive, the typing should be implied and checked by some external tool, as it’s done in Erlang. Making types a part of the language is plain wrong. Sometimes I just want the function to accept anything.

code of conduct - report abuse