Live data from Hacker News

The JavaScript Problem

haskell.org

41–50 of 183 posts

Re: The JavaScript Problem

#41

The people who hate javascript the most are the ones who wish it was something else. I used to be one of those people. Once I decided to accept it as it is and read a few top books on the language to learn the "javascript way", my life got a lot better. It's really not that bad. I actually like it a lot, but there are still a lot of ignorant people who will look at you as if you're not l33t enough to know that foo la…

If you want to build a web app in Haskell instead of the web's true lingua franca, all you're accomplishing is making it harder to hire and harder to collaborate. We should be making the web multi-lingual. It's kind of absurd that we've built these great abstractions over HW and few people ever think about writing machine language. But for the web, an abstraction over several abstractions, we're largely stuck with a…

Browsers should not be multi-lingual -- more bloat.

The "compile X to javascript" movement has things half right. Unfortunately the "compile to" is Javascript. I wish the language the browsers implemented was something more modern, strong typing, etc. But I am not sure that will happen.

Re: The JavaScript Problem

#42

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…

This is well put, but I can't offer the same concession about "this" ... what exactly is the problem? It provides access to the state of the object on which you are working, if utilizing OO paradigms within JavaScript. Sure "this" values when executing pure functions in some runtimes make little sense but if you understand what "this" means with respect to OO, you wouldn't be trying to access it in that situation in the first place.

Re: The JavaScript Problem

#43
post #34

The people who hate javascript the most are the ones who wish it was something else. I used to be one of those people. Once I decided to accept it as it is and read a few top books on the language to learn the "javascript way", my life got a lot better. It's really not that bad. I actually like it a lot, but there are still a lot of ignorant people who will look at you as if you're not l33t enough to know that foo la…

Javascript's real problem is unfamiliar semantics hidden behind familiar syntax. It throws people off and they hate the language because they think it's weird. Really, they just haven't learned how to actually use it.

Javascript is a tiny language, but it pack a serious amount of gotcha.

If you learn the javascript way, you just realise that the core language provide little to no tooling around it. Like if you really want to fully utilise the prototype based inheritance, or the functional aspect of the language, you will basically have to write a whole set of utilities and extension on your own.

Of course, javascript run in the browser, is small and super simple, so it packs a lot of fun. To me it oddly reminds me toying with assembly in the old DOS 16 bit days and I like it despite its flaws ( and well those flaws are being addressed in latest iterations ) But the flaws are real, and if you need to use it on a big project with a regular team, and not complete freedom of choosing the browser you support, javascript will make you cry more often than smile.

Re: The JavaScript Problem

#44

The people who hate javascript the most are the ones who wish it was something else. I used to be one of those people. Once I decided to accept it as it is and read a few top books on the language to learn the "javascript way", my life got a lot better. It's really not that bad. I actually like it a lot, but there are still a lot of ignorant people who will look at you as if you're not l33t enough to know that foo la…

I think it comes down to two things.

* Acknowledging that it has many many warts. Weak types, modularity, every number is a double, etc. some of those warts are there. Explaining why they are there historically doesn't make them go away either. "Oh but it was only written in 1 month so.." -- "Yeah it is still broken".

Many things can be chucked to "not broken but different". But, some are just broken, no sane language released after 1990's should not be this broken unless it was on purpose (brainfuck).

* Realizing that in practice, currently, there are not too many alternatives and just learning to use it. Like you say just getting down to being pragmatic. One can talk about functional purity but that doesn't usually bring food to the table. A finished site does.

But you see how the two are different. Many confuse them. For example, saying the language is fine and great just because they learned it and are using it. Yeah, at some level we want to feel good about the tools we use, so it is harder psychologically to say "this stupid thing I have to use every day". It goes the other way, just because the language is broken and there is some pure language, re-writing the site into might be very risky.

I personally am looking at Dart with excitement but at the same time won't be urging anyone yet at work to switch to it yet. Kind of a chicken and egg problem, I understand, we just can't afford to take that risk yet. But with time who knows.

Re: The JavaScript Problem

#45

The people who hate javascript the most are the ones who wish it was something else. I used to be one of those people. Once I decided to accept it as it is and read a few top books on the language to learn the "javascript way", my life got a lot better. It's really not that bad. I actually like it a lot, but there are still a lot of ignorant people who will look at you as if you're not l33t enough to know that foo la…

[deleted]

Re: The JavaScript Problem

#46

Earlier quoted context omitted.

If you want to build a web app in Haskell instead of the web's true lingua franca, all you're accomplishing is making it harder to hire and harder to collaborate. We should be making the web multi-lingual. It's kind of absurd that we've built these great abstractions over HW and few people ever think about writing machine language. But for the web, an abstraction over several abstractions, we're largely stuck with a…

Browsers should not be multi-lingual -- more bloat. The "compile X to javascript" movement has things half right. Unfortunately the "compile to" is Javascript. I wish the language the browsers implemented was something more modern, strong typing, etc. But I am not sure that will happen.

JavaScript and HTML are a lot more bloat than machine language code written to the wire.

Writing in a language appropriate to the task is almost always the right tradeoff.

Re: The JavaScript Problem

#47
post #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. Th…

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

Only a perfect type system is capable of preventing only wrong things, and allowing all correct things. In the mean time, we're left with things that are slightly less perfect. Like OCaml, Haskell, SML, Java, Smalltalk, Ruby, Javascript, Python, PHP, Prolog, and everything else that even attempts a type system.

Re: The JavaScript Problem

#48
post #21

Earlier quoted context omitted.

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'?

I assume it's referring to the fact that 'this' changes in a given piece of code depending on how it's called, whereas other vars are lexically scoped, so you are often forced to work around the issue by making your own lexically-scoped equivalent, aka the old "var self = this;" trope.

and this is perfectly fine. it allows you to do more if you know how to use it. and if you don't - it is really simply to understand. again - this is how js different from many (all?) languages out there, but why it is bad - i am not sure. extra line of code in some cases? I don't think this is really that bad.

Re: The JavaScript Problem

#49
post #43
post #34

Earlier quoted context omitted.

Javascript's real problem is unfamiliar semantics hidden behind familiar syntax. It throws people off and they hate the language because they think it's weird. Really, they just haven't learned how to actually use it.

Javascript is a tiny language, but it pack a serious amount of gotcha. If you learn the javascript way, you just realise that the core language provide little to no tooling around it. Like if you really want to fully utilise the prototype based inheritance, or the functional aspect of the language, you will basically have to write a whole set of utilities and extension on your own. Of course, javascript run in the br…

Considering the language was created in about a week, Javascript is nothing short of a computing miracle.

It has enabled anyone with a web browser to write software that can run on billions of computers.

And it is extremely easy to learn and use, with no boilerplate whatsoever.

People who require the boilerplate to feel comfortable probably shouldn't use Javascript, and should have their heads examined.

Re: The JavaScript Problem

#50
post #2

I'm surprised that Elm is not mentioned: http://elm-lang.org/edit/examples/Reactive/ZipCodes.elm True, it's not Haskell, but it's clearly highly-influenced by Haskell. Besides, they mention Fay, which isn't Haskell, either. If the Haskell wiki didn't require a log-in and registration that requires special, personal permission, I'd add it myself.

I don't recommend Elm because it's not Haskell and it's too boxed into its way of doing things. Elm is really, really far from being an acceptable substitute for Haskell. It's a gap comparable to that of what Java and Scala can do.

PureScript is a better choice for a Haskell'ish language that is generically applicable to both browser and node-backed JS.

Importantly, you can decide how you want to do FRP/callbacks/whatevers according to the needs of the libraries/app/problem you're working with.

Also, PureScript has typeclasses, higher kinded polymorphism, the works. It even has some cool stuff that Haskell does not built in!

See this post for example of why higher-kinded polymorphism is important: http://bitemyapp.com/posts/2014-04-11-aeson-and-user-created...

Post reply on HN