3 ms·
I know typescript is really popular around here. And I do like it for autocompletion and refactoring. But am I the only one who thinks typescript makes code unr
by kabes 7y ago
I know typescript is really popular around here. And I do like it for autocompletion and refactoring. But am I the only one who thinks typescript makes code unreadable? It looks so messy. I can understand a piece of normal js way faster than the same code with types. Don't have this problem with, for example, java. Maybe it's the syntax with the colons or the fact that I'm used to types appearing before the name instead of after...
- nevi-me 7y agoAutomatically ignoring types comes with intuition. After a while, you start seeing beyond the types. I hope and assume this is normal, because I've experienced this type blindness in all types languages that I've used. It's interesting that you don't have this problem with Java, is it because Java always has types, while TS is lenient?
- cjbprime 7y agoIt's also possible that you're providing types that inference was capable of working out on its own. You shouldn't be seeing type annotations everywhere.
- afraca 7y agoI applaud Microsoft for popularizing gradual typing , bringing types to the js world is an enormous task, both technical and (js-)societal. Regarding your syntax criticism: I quite agree. I really really like the path chosen by Haskell. Types are obviously a major part of Haskell, but there you just separate the type signature from the implementation. emap :: (DynGraph gr) => (b -> c) -> gr a b -> gr a c emap f = gmap (\(p,v,l,s)->(map1 f p,v,l,map1 f s)) where map1 g = map (first g) (Of course there are other helping things like type synonyms, which TS also supports) type UPath = [UNode]
- mcbits 7y agoI don't find that remotely readable. By that I mean that nothing in the code gives me the slightest inkling of what kind of command I would type or button I would click, expecting this code to run in response.
- mschuetz 7y agoThere are a lot of languages where even if you don't know that language, you can figure out what's happening. I have no idea what your example is supposed to do.
- elbear 7y agoThat's because it's taken from a library that deals with graphs[1]. I had to look it up, because I had no idea what it does either and I know Haskell. Here's a better example of what he meant in Elm, a language that looks a lot like Haskell: https://github.com/bryanjenningz/25-elm-examples/blob/master/18-editable-todos.elm https://github.com/bryanjenningz/25-elm-examples/blob/master... [1]: http://hackage.haskell.org/package/fgl-5.7.0.1/docs/Data-Graph-Inductive-Graph.html http://hackage.haskell.org/package/fgl-5.7.0.1/docs/Data-Gra...
- Old_Thrashbarg 7y agoPerhaps you can set your IDE to gray out the types.