Live data from Hacker News

JavaScript is Good, Actually

ashfurrow.com

131–140 of 369 posts

Re: JavaScript is Good, Actually

#131

Earlier quoted context omitted.

1) Many languages won't allow you to redefine a type. 2) Mutate the prototype of a "frozen" object and you would indirectly affect it through its prototype chain... or mutate an nested property inside a "frozen" object. Most of JS standard library and most popular frameworks and libraries have fully mutable definitions. That sucks and is BAD design decision.

> Many languages won't allow you to redefine a type. This counterargument is not a good one. Just because other languages do things a certain way doesn't mean it's the right way in every situation. C++ has multiple inheritances and template metaprogramming, but that's C++. > Most of JS standard library and most popular frameworks and libraries have fully mutable definitions. That sucks and is BAD design decision. It'…

1) Template meta-programming is vastly safer than preprocessor macros. Then, today you have constant expressions, which overlap with some of the use-cases of template meta-programming. In any case, template meta-programming is not strictly required to get things done in C++. Multiple inheritance can be caught by static analysis.

2) Just like you can polyfill your code, malicious input can poison your prototypes.

Re: JavaScript is Good, Actually

#132
post #96

Earlier quoted context omitted.

Given his github profile, I think we can give him credibility that he is pretty good. https://github.com/ashfurrow

Well, I just looked through some of his commits on some of the repos. Not pretty good. Productive maybe but definitely not good. Commit messages are quite lacking he's hard coding user display strings. Without spending more time or having some domain knowledge of his problem, I can't really comment on the architecture setup/choices.

You’re showing your inexperience here nitpicking on commit messages (set by team / project conventions) and situational things like constants.

I’d work with Ash any day of the week.

Re: JavaScript is Good, Actually

#133
I never felt the author got around to describing what makes Javascript good. I mean, hey, it's indisputable that lots of people love it, and it's fine to write up an article defending its quirks. But the existence of good tools, an OSS community, and reasons for the quirks don't sum up to a reason to try Javascript. I was hoping for some more insight into the language itself, but that was never touched on.

Re: JavaScript is Good, Actually

#134
post #68

I am primarily a C++ dev and had to use JS for web development. Having no previous scripting experience, I was gobsmacked at the ease and freedom it offered, especially wrt string processing. You need to have been a monolingual C++ dev to appreciate what I said. I don't hesitate to say I like JS. These days I try creating any small experimental programs I need in JS and run them in FF instead of starting the whole bu…

Why not use node so you can avoid the browser and the extension?

Because there is usually a need to input data or parameters and I prefer a GUI textbox more than file based or command based approach. I also prefer visual inspection and debugging. Browsers make all this simpler.

Re: JavaScript is Good, Actually

#135
> I’m not going into more detail because syntax is… well it’s not that important to a language. Syntax is (I’m waving my hand dismissively here) just syntax

Tell that to Brainfuck.

Sure, JavaScript is a great language if you ignore all the shitty parts.

Re: JavaScript is Good, Actually

#136

Earlier quoted context omitted.

> It's not a great language (clearly demonstrated by the discussion about it being good or not) but it's not terrible I'm wondering what would be an example of a great language? Because we know that there are only two kinds of languages: the ones people complain about and the ones nobody uses

My response to this is usually that Ruby is a great language because it's easy to get useful work done with a large, meaningful subset of the language. You can ignore the warts just by not using them. You can't do that in JS, because the warts are so fundamental. (yes, you can be tripped up by library authors in Ruby, but there's community backpressure against providing footguns).

One can make the exact same argument for JS as well - I’m not sure what distinguishing point is intended here.

Re: JavaScript is Good, Actually

#137
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…

The generators or async/await in JS are 'shallow' coroutines because you can only `yield` or `await` in the direct scope of a generator or async function, but the benefit of shallowness is that the control flow is explicit; you don't have to consider whether a function call will suspend the calling context's execution or not. I find the explicit clarity to outweigh the reduced power of shallow coroutines.

As an aside, there exist green threads in JS, namely node-fibers, although it's only a Node.js extension.

You actually can reflect on module exports and dynamically change them with node modules; you can't do it with ES modules, but that has the significant advantage of enabling static analysis.

Proxies absolutely can trap the property assignments you mentioned, but Vue can't take advantage of this because Proxy can't be polyfilled in older browsers.

As for the enumerate handler, it would only have worked with for-in loops, which are a legacy feature. The iteration protocols used by for-of are a much more flexible solution. It might seem silly to have both for-in and for-of loops, but the context of the language is that it can't just go and break older websites. Same goes for == and ===, etc. Linters come in very handy for dealing with this.

Your criticism is better than most, which usually just point out some "wat" moments with mis-features like implicit coercion, but you didn't really make a case for having to do "all things by hand" in JS.

Re: JavaScript is Good, Actually

#139

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…

You should try Kotlin. It solves exactly this pain point - creating classes for data structures is very terse and easy. You can have a one-liner class like class Person(val name: String, val email: String, val yearOfBirth: Int? = null) Or you can make it a `data class` and get automatic `equals` and other things.

Concepts borrowed (in a simplified form) from Scala.

Re: JavaScript is Good, Actually

#140
post #71
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…

What are great languages in your opinion?

Take a look at Common Lisp, Haskell, Smalltalk, and Prolog to see examples of great languages.
Post reply on HN