Live data from Hacker News

JavaScript is Good, Actually

ashfurrow.com

331–340 of 369 posts

Re: JavaScript is Good, Actually

#331

Switching back to Java after having spent a long time in JavaScript land with modern standards made me realize how great JavaScript had become. The biggest reason for JavaScripts greatness to me is JSON. I couldn't understand how Java developers put up with such bulky ways to deal with data. After some time in Java land I've come back to appreciating its strengths again though. Code completion is nice. I'm kind of ho…

I'm using JSON all the time, but it's hardly the be-all/end-all solution for even the basic use case of service payload serialization, let alone config file syntax or document syntax. To begin with, JSON lacks types for URLs, dates/times, and spatial data; it also lacks conventions for error messages and data graphs other than trees, etc. So I think Java not integrating JSON literals at the language level or some suc…

I think that lack is a strength. Lists, Maps, Booleans, Numbers, Strings. With these powers combined, you can create basically anything you can think of. Dates can be unix timestamps or ISO strings which are universal. Spatial data is a compound datatype anyway (plus, there are quite a few data representations depending on number of dimensions, cartesian vs polar, etc). The one datatype that JS could potentially benefit from is a byte array type, but even that can be accomplished with base64 "strings" or Lists of numbers.

To me, it's much better to let every company send error messages in the format that makes sense to them rather than having the One True Error that doesn't quite work for anyone.

My biggest complaints about JSON are syntactic. Optional comments, multi-line strings, and trailing commas would do wonders for day-to-day readability without significantly bloating the specs.

Re: JavaScript is Good, Actually

#332
post #287

I forgive Javascript any "language flaws" it might have. Why? Because the truly beautiful thing about Javascript is that you can write a program, send anyone a URL and they can run it. No compilation, no installation - just open the URL in any browser. No other language in the world can do this in such a universal way. Simplicity is bliss.

Yeah, because people usually compile their programs before running them.

> Yeah, because people usually compile their programs before running them.

The developers do, yes; with Javascript, they don't have to worry about compiling for multiple platforms like, say, a C developer would, they could even just ssh into a server and edit a single text file while everybody across Windows/Linux/MacOS/iOS/Android/etc can run the new version as soon as you save the file (mod browser compatibility issues, of course). I think their point was that Javascript is the only language that can do end-to-end simplicity like that.

Re: JavaScript is Good, Actually

#333
post #65

Earlier quoted context omitted.

You still need to make `ObjectStream os = new ObjectInputStream(new FileInputStream(filename))); MyObject mo = (MyObject) os.readObject();` which is the most basic form I can think of (you've got to put in all them bloody `try/catches` as well don't forget, along with `public class MyClass { public static void main(String[] args) { ...` etc. etc.). Whereas javascript you can just go `require(myjsonfile)` I love java,…

> Whereas javascript you can just go `require(myjsonfile)` I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the file and `eval()`ing it?

This is the community that installs things by curl|sudo bash, remember

Re: JavaScript is Good, Actually

#335

I don't think anyone benefits from watering down the definition of "good" to the point where it describes Javascript. Javascript – sorry, modern Javascript – sorry, surfing a compile-to-JS liferaft atop a thick and constantly shifting foam of tooling and libraries disgorged by literal person-millennia of community effort – can be surprisingly decent if you're careful. Any meaningful definition of good has to draw a l…

>how excited we are for ASYNC COME FROM to land in INTERCAL2018. And, hey, it's not perfect, but it gets the job done, there's a good community, and at least it's not Objective Malbolge.

That made my day and next few mornings, thank you.

Re: JavaScript is Good, Actually

#336
post #321

Earlier quoted context omitted.

I don't think I'm arguing the perfect language exists, nor do I think a complete education reform is needed. I'm arguing that "Python is easier" is false, simple as that.

And I'm arguing that the average newcomer (if we need a specific definition of average, how about chosen at random among low-income American sixth graders far removed from big cities like San Fransisco or New York?) would have an easier time understanding Python to the level of being capable of basic file/network I/O than they would with Haskell, because Python will be more immediately familiar to them because they d…

I understand that's what you're saying, and I'm saying you're wrong because:

- Beyond toy examples, writing Python isn't easier. Writing reliable, easy to maintain, bug-free Python programs is just as difficult, and your average person won't be able to do it right off the bat.

- You don't need to really know what a monad is in order to write Haskell as a beginner; that's a red herring.

If you want to argue that it's easier to write toy examples in Python, without regard for good programming practices, then... it'd still be debatable: if I remember correctly, some years ago there was a post here about someone teaching Haskell to highschoolers, to great success. They found it fun and easy.

Re: JavaScript is Good, Actually

#337
post #123
post #39

Semantics and configurability is what what makes a language great. JS doesn’t have function environments, i.e. every unlexical lookup goes to global/window and that cannot be redirected. It doesn’t have green threads (at least). There are generators, but one cannot just yield without marking all the functions generators too (async/await in modern terms). Stack traces are lost when generators throw(). JS has no good i…

Imo, all people saying that some language or tech is good enough seriously lack imagination. Things could be so much better.

Yes, this same lack of imagination is why kludge after kludge is piled on at so many software shops. That and an absolute dearth of people that actually take pride in their work.

Re: JavaScript is Good, Actually

#338
post #263

Earlier quoted context omitted.

This is the one criticism of Haskell that in my opinion has no merit. Programming languages are not intuitive. They are a learned skill. You know the saying (sometimes said as a joke) "such-and-such language failed because it didn't have C-like syntax" -- but C-like syntax is NOT intuitive! Reading C code is a learned skill. Maybe it could be amended to "since many programmers learned to program using languages with…

> Programming languages are not intuitive. They are a learned skill. True. > C-like syntax is NOT intuitive! Reading C code is a learned skill. Also true. > Haskell is no more or less intuitive than JavaScript. This does not follow. I have to learn the syntax of any language, true. But that doesn't mean that all languages are equally easy/hard to learn. I learned C by reading K&R over Thanksgiving weekend while in co…

It doesn't follow because it's just my opinion :)

I don't think the relative intuitiveness of Haskell vs JavaScript is a settled matter. I'm arguing one or the other may seem more intuitive because of past familiarity with similar languages/paradigms.

For example, some people -- though not in this thread, thankfully -- make much about Haskell's allegedly weird syntax and/or operators. Never mind that its syntax is not particularly large, but also there's nothing immediately intuitive about a lot of C code in comparison. What's with all those "{}" and ";" and "*" and "&"? Parsing operators, especially with parens and pointer dereferencing involved, can be difficult, even without deep nesting, and even experienced coders occasionally trip over some production C code. Yet no-one uses this as an argument for C being "too difficult" or "too unintuitive". I argue this is because C was a language they learned long ago, and it has colored their perception of what is familiar or "easy" about programming languages.

Re: JavaScript is Good, Actually

#339
post #27
post #7

Earlier quoted context omitted.

Not really, Typescript is mostly a superset of ES2015 and is compatible syntax wise. It has almost no new "features" (apart from enums and namespaces, I think) and only contains a typing + visibility system and related syntax on top. The only part that is not ES2015 in the given code example is the ' as ConsignmentSetup' cast.

By that definition C++ and C are the same languages. But everyone knows they aren't. And both C/C++ are statically typed languages! You can't just drop a static type system into a scripting language and claim it's an irrelevant difference! I agree with the other posters - there are probably good defences of JavaScript that can be written, but writing an article about how great JavaScript is and then showing a code sa…

[deleted]

Re: JavaScript is Good, Actually

#340

Earlier quoted context omitted.

No, Python is much more enjoyable than JS (see what happens when you turn subjective statements into objective ones?). It feels to me like JS is more for people who want to write "clever" code and Python is for people who want to write boring, more maintainable code. It doesn't help that JS has a gentler learning curve and attracts more people who just want to get things done without thinking whether those things sho…

JavaScript is more enjoyable than Python to me. You can’t really say no to that. IMO JavaScript is for people who want to get things done quickly and efficiently and have their program work everywhere. Python is for people who like to think they are doing things “the right way” as if there were such a thing.

> JavaScript is more enjoyable than Python to me. You can’t really say no to that.

Indeed I can't. I can say no to "JS is more enjoyable than Python", which is what you said in your upstream comment.

> JavaScript is for people who want to get things done quickly and efficiently and have their program work everywhere

If by "everywhere" you mean "in a browser", sure. I don't see how that's related to the common definition of "everywhere", though.

> Python is for people who like to think they are doing things “the right way” as if there were such a thing.

I don't know what you mean by that.

Post reply on HN