4 ms·
> They will teach you concepts you can take back into PHP or Node.js Curious what these are. The only thing I retain back in dynamically-typed land is "argh I
by johnfn 10y ago
> They will teach you concepts you can take back into PHP or Node.js
Curious what these are. The only thing I retain back in dynamically-typed land is "argh I wish this was statically typed!"
- twoquestions 10y agoI've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though.
- joe-user 10y ago> I've worked with functions in JavaScript that change functionality radically depending on whether you pass an integer or an object. > I thought this was the way of the world until I got deeper into typed languages, where you learn why not doing that is good. Type envy still stings though. This is just polymorphism, isn't it? Why is this not a good thing?
- twoquestions 10y agoIn small doses it's fine, but 2000 line functions whose branches have nothing to do with each other is hard to fit in one's head. The great thing about statically-typed languages is that they help you write your software instead of giving you a blowtorch and saying "have fun". I know a lot of people find that a bit patronizing, but I'm not one to turn down help (especially from a bot that won't call me on it later).
- joe-user 10y agoI'm not sure I follow. I don't find "2000-line functions whose branches ..." to be a requirement for polymorphism. I'm also not against static typing, but I am against thinking it's a silver bullet. Consider this: `function inc(x: number): number { return x - 1; }`. It passes the type checker, but the blow torch still burned you.
- agentultra 10y agoA monad is a mathematical abstraction. There's nothing special about Haskell that makes it work with monads. They work great in Javascript, C, Python... the syntax of those languages don't make it terribly easy to work with them but it's still available. You have to be disciplined since you don't have the type system checking your work for you but you still get the benefits of the abstraction. I'm presently trying to make this a little better in my own team's codebase by trying to introduce Flow [0]. There are a lack of definitions for the monadic libraries we use which I'm presently remedying. It's not pretty -- and my kingdom for OCaml or GHC! -- but it's better than not having it. Knowing the fundamentals will help you learn to structure code and think clearly about abstractions. It's the difference between merely using something and understanding how it works. In the latter case you have the power to exploit it.
- deleted 10y ago[deleted]
- jwdunne 10y agoThe syntactic sugar is perhaps what's special. Code without that isn't so pretty. I do find it impressive, however, because it's based on an abstract, wide-ranging and extremely useful concept that can actually be expressed in the language without it. It follows the pattern that much syntactic sugar we take for granted has followed e.g a while loop is sugar on top of jumps and branching.