5 ms·
> lack of module system ES6 fixes this with, well, a module system. > weak-typing, Yup, this is a problem. > verbose function syntax, ES6 fixes this with a
by pcwalton 13y ago
> lack of module system
ES6 fixes this with, well, a module system.
> weak-typing,
Yup, this is a problem.
> verbose function syntax,
ES6 fixes this with arrow functions.
> late binding
Does this just mean dynamic typing? Well, yes, JavaScript is dynamically typed, but I wouldn't call that a language flaw. Static vs. dynamic typing is a tradeoff.
> which has led to the creation of various static analysis tools to alleviate this language flaw
The footnote talks about JSLint and friends, but none of those impose a type system, which means that they do nothing about dynamic typing.
> but with limited success (there is even a static type checker)
Well, yeah. It's very hard (read: "research problem") to impose a good static typechecker on a dynamically typed system, though.
> finicky equality/automatic conversion
Yeah, this is bad. I really wish tools like restrict mode [1] had caught on: together with ES6 they eliminate a lot of what people dislike about JavaScript.
> this behaviour,
Fixed in ES6 if you use arrow functions (finally!)
> and lack of static types.
Again, I wouldn't say it "sucks" for this reason, just that it's dynamically typed. That's a tradeoff.
[1]: http://restrictmode.org/ http://restrictmode.org/
- teacup50 13y ago> Again, I wouldn't say it "sucks" for this reason, just that it's dynamically typed. That's a tradeoff. This is the Haskell wiki. I would expect most participants to view having a single global implicit union type to be a flaw, not a trade-off.
- djur 13y agoIt's sad that we should expect Haskell users to be chauvinistic about static typing. I have yet to read anyone who advocates for dynamic typing describe static typing as a "flaw".
- copergi 13y ago>It's sad that we should expect Haskell users to be chauvinistic about static typing. We don't expect that. We expect them to recognize that better type systems are better than worse type systems. Which seems pretty obvious when stated that way. >I have yet to read anyone who advocates for dynamic typing describe static typing as a "flaw". Try looking on the internet. Every "static vs dynamic" argument has 99% of the dynamic side arguing that static typing is bad because java's type system limits them and doesn't prevent any bugs.
- jkrems 13y ago> We expect them to recognize that better type systems are better than worse type systems. Which seems pretty obvious when stated that way. Obvious - because you just said "with better defined as has more static typing, static typing is better". That's an empty statement if I ever saw one.
- copergi 13y ago>because you just said "with better defined as has more static typing No I did not. Haskell's type sistem is not "more static" than javas. It is more powerful. This makes it better. There are not varying degrees of "staticness". There are varying degrees of expressiveness. Haskell is on the "very expressive" end of that scale. So it makes sense to assume that haskell people consider more expressive type systems to be better.
- teacup50 13y agoThat it's better to accurately and reliably modeling complex systems and invariants through provable assertions is objectively is no more an empty statement than to say that it's better to apply informed materials and structural engineering to the design of complex physical products than to build ad-hoc designs of unknown parameters through guesswork.
- jkrems 13y agoIf you think that building software is like building bridges, then yes. If you think that it's the exploration of a problem domain that may not be known to you at the start of the process and is subject to various degrees of iteration (e.g. a process more like writing a script/play), then you get vastly different requirements. That's what I meant by "if you define better as more static typing". "Better" is a normative statement and can never be absolute, it's always relative to a choice.
- teacup50 13y agoI don't see how it follows that iteration reduces the degree to which one must understand a system. That's just a rephrasing of the attractive but ultimately empty "dynamic typing is just more creative." Bridges (or car engines, or any other engineered product) aren't invented whole cloth sans iteration. However, it's understanding of the invariants of the iterated system that allow for directed iterative design and ultimately better products. Rather than repeat this argument, I'll refer to https://news.ycombinator.com/item?id=7656184 https://news.ycombinator.com/item?id=7656184
- teacup50 13y agoThere's nothing chauvinistic about it. If you want to hear people honestly and accurately describe "static" type system's flaws -- talk to type system theorists. Type systems can be provably flawed. What you can prove about a uni-typed late-bound ("dynamic") languages is quite simply that they're unilaterally flawed.
- djur 13y agoThe chauvinism involved is the assumption that a type theory is the only legitimate way to assess the quality of a programming language's type system. Haskell is, of course, a near-ideal language when judged by the values of its creators and advocates. The inability to recognize that those values are subjective is chauvinism.
- teacup50 13y agoIt's chauvinistic to believe that the only way to assess math is through deductive reasoning? By that measure, all "STEM" fields are inherently "chauvinistic".
- djur 13y agoProgramming isn't math.
- teacup50 13y agoThat's really, really funny. Engineering isn't math either, but you can't do it right without math.
- djur 13y agoI know some people really want programming to just be an application of the lambda calculus. It's a model that really appeals to people who prefer a top-down, deductive model to their work. It's similar to the appeal that draws people to Austrian economics. And yet that is not the original model for thinking about software, nor the only valid one. Haskellers who rely solely on deductive arguments in favor of their method are going to be stuck forever wondering why so few people are using their clearly superior tool.
- _random_ 13y agoBest languages allow both type systems with dynamic being opt-in.
- deleted 13y ago[deleted]