top | item 30807289

(no title)

vereis | 3 years ago

TypeScript bringing a half decent type system to JavaScript is orthogonal to OOP

JavaScript is OOP already. TypeScript just provides better typing like what you would find in Haskell, Ocaml or other functional languages

discuss

order

jaytaylor|3 years ago

You are technically 100% correct, however the bultin object system in Javascript is so bad that a reasonable argument can be made that it's not particularly accessible or ergonomic to many of the folks who actually write it for a living.

I know lots of folks here on HN are super highly competent, and this contrasts with my IRL experience with colleagues who are less passionate about programming and just want to do their job- these folks aren't going to be teaching lessons in proper usage of objects in JS.

ovao|3 years ago

It’s hard to tell, but are you referring to prototypical object inheritance here? If so, JavaScript has long since implemented more traditional class definition ergonomics, such that explicit prototyping is almost largely unused in modern codebases.

In truth, even classes are becoming increasingly uncommon in JavaScript codebases, and most object usage in JS these days is struct-like, where the ergonomics are pretty similar (or identical) to other languages.