Live data from Hacker News

The JavaScript Problem

haskell.org

21–30 of 183 posts

Re: The JavaScript Problem

#21

I take issue with the paragraph about how Javascript sucks: * Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types) and I don't see that as a problem. * Being an entirely interpreted language, JS cannot have static type checking. This has not been an issue in my experience. * I think the syntax argument is laughably ridiculous. Programming languages that live…

Could you clarify on `this`? I find how it works very obvious and natural to me, therefore not quite sure why everyone consider it broken and not 'different'?

Re: The JavaScript Problem

#22
> 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/

Re: The JavaScript Problem

#23
I accept that I will be downvoted for this.

My impression of the Haskell community is its full of snobbery and complaining.

This has got to be the 4th javascript ducks post on hn in the past week.

I like hearing the positive aspects of Haskell. However, the language x sucks posts are tiresome.

Develop an imagination. Javascript can be wielded very effectively. It's just different. I hope that I or someone else wires posts on what can be done to be effective with javascript and weakly typed systems.

There are advantages to using weakly typed languages, mostly centered around flexibility and rapid iteration. The disadvantages are alleviated by comprehensive functional or black box testing. Skip the unit tests.

I feel liberated by not having a strong type system restricting my options. Ymmv. People have different styles and preferences.

Re: The JavaScript Problem

#24

I take issue with the paragraph about how Javascript sucks: * Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types) and I don't see that as a problem. * Being an entirely interpreted language, JS cannot have static type checking. This has not been an issue in my experience. * I think the syntax argument is laughably ridiculous. Programming languages that live…

* Being an entirely interpreted language, JS cannot have static type checking. This has not been an issue in my experience. This doesn't mean it isn't an issue, just you haven't encountered a situation where it is. * I think the syntax argument is laughably ridiculous. Programming languages that live in glass houses shouldn't throw stones. Just today, I've seen three links to guides "to learn basic Haskell syntax", t…

>This doesn't mean it isn't an issue, just you haven't encountered a situation where it is.

You're right, but it seems to be fairly rare. I've only once ever seen static type checking help find bugs in rarely-used code paths, and that was a single occurrence five years ago.

>And you've never seen three guides to "learn basic Javascript syntax" which contradict each other?

No, I haven't. The only things I can think of off the top of my head that a JS newbie would find contradictory are semicolons and declaring arrays with [], both of which are used by the vast majority. I've only seen one codebase ever that used new Array(), and only a handful that didn't use semicolons unless necessary.

>You can argue it both ways, as far as I am concerned. Javascript like any other language has issues, what exactly those issues are... depends greatly on what you use Javascript for.

Good point. Claiming Javascript is issue-free is as ridiculous as claiming that (to quote this guide) "Javascript sucks".

Re: The JavaScript Problem

#25

I accept that I will be downvoted for this. My impression of the Haskell community is its full of snobbery and complaining. This has got to be the 4th javascript ducks post on hn in the past week. I like hearing the positive aspects of Haskell. However, the language x sucks posts are tiresome. Develop an imagination. Javascript can be wielded very effectively. It's just different. I hope that I or someone else wires…

Here's the problem with your post - and it has nothing to do with what you think it does. It attacks two things at once and quite distinctly. On one hand you're defending JavaScript - and that's separate from your attack on the Haskell community. It's just unfocused and confusingly conflated. I'm not going to down vote you, but you need to organize your thoughts a little more coherently if you don't want to get down voted.

PS The reason there are so many JavaScript sucks posts is because JavaScript, a language designed for very menial things in 10 days in the mid 1990s, has become the lingua franca of the world and is used for sophisticated applications outside of its wheelhouse. A lot of very respectable people believe it's a poor tool for the complex applications that it's being used for and the less respectable people just reiterate this as "it sucks". It's not that it sucks for making a photo gallery, it's that it sucks compared to other languages for making a rich, modern, immersive, large application. They key word there is large. All of the reasons they reiterate about the "why" it sucks are only relevant when you couple it with the "large".

Re: The JavaScript Problem

#27

I take issue with the paragraph about how Javascript sucks: * Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types) and I don't see that as a problem. * Being an entirely interpreted language, JS cannot have static type checking. This has not been an issue in my experience. * I think the syntax argument is laughably ridiculous. Programming languages that live…

> Javascript is actually untyped, not weakly typed (untyped means no type declarations, not that it has no types)

I've never really heard the term untyped before -- I guess I'm old school and still call that dynamic typed. But JavaScript is also weakly typed. It will automatically convert strings to numbers, etc. Some languages, like Python, are dynamically typed but also strongly typed: No type declarations but no automatic conversions.

Re: The JavaScript Problem

#28

> 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 all…

> 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.

Re: The JavaScript Problem

#29

I accept that I will be downvoted for this. My impression of the Haskell community is its full of snobbery and complaining. This has got to be the 4th javascript ducks post on hn in the past week. I like hearing the positive aspects of Haskell. However, the language x sucks posts are tiresome. Develop an imagination. Javascript can be wielded very effectively. It's just different. I hope that I or someone else wires…

>My impression of the Haskell community is its full of snobbery and complaining.

Probably because the Haskell community is used to having a programming language that is, in and of itself, very good. They complain because they know what they're missing when they have to use inferior tools.

>Develop an imagination. Javascript can be wielded very effectively. It's just different.

The same can be said of x86 assembly. That doesn't mean we don't complain about programming in it, and we don't try to find better alternatives. The entire field of programming language development is about finding tools that are better than the old ones, even if the old ones work OK.

>The disadvantages are alleviated by comprehensive functional or black box testing.

If you think "more testing" alleviates all the problems of weakly typed languages, you have no idea what you're missing.

>I feel liberated by not having a strong type system restricting my options.

If you feel restricted by a type system, you're using it wrong. A type system is a useful tool, not an impediment. It only prevents you from doing wrong things.

"I like assembly because it lets me do any operation on anything."

Re: The JavaScript Problem

#30
post #8

I'm going to chime in to the chorus of "Why wasn't X mentioned" and throw out Scala.js. It would seem that Scala solves quite a few of the article's complaints about Javascript, and in a manner that is accessible and usable for the masses. I love Haskell as much as the next guy, but I'd rather use Scala if i need to get stuff done.

[deleted]
Post reply on HN