Live data from Hacker News

JavaScript is Good, Actually

ashfurrow.com

251–260 of 369 posts

Re: JavaScript is Good, Actually

#252
post #175

I have been working with elm for 2 years now and shipped 4 projects. I can say a lot of good thing about elm, but the most important one, and something that outweight a lot of thing is maintainability. Each time I had to change something in a shipped app it was painless, stressless (I know I won't add regression) and fast. I won't say JS is bad, but the absence of a compiler makes it much more fragile, especially whe…

Almost everyone writing JavaScript these days uses a compiler like Babel, webpack, browserfy etc..

I think by "compiler", they really mean "typechecker", which is much more important for maintainability than code transformations.

JavaScript does has two good typecheckers, TypeScript and Flow.

Re: JavaScript is Good, Actually

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

> Stack traces are lost when generators throw(). V8 (and probably others) now has some special cases for async functions (and generators, I think, but those are much more rare) to show useful stack traces with the lineage of async calls. For example, this code shows the stack trace you'd expect when run in latest Chrome or Node.js. async function c() { throw new Error('Some error'); } async function b() { await c();…

Yeah, V8 in particular has possibly the best debugger tool available in any language ever; an easy to use UI, but still absolutely chock full of just about every useful feature you could imagine.

Re: JavaScript is Good, Actually

#255

Oh man, I hate these articles as they bring out the trolls. Javascript is a great language because it allows you to develop incredibly fast (scripting language) for a platform that runs everywhere (the web). It used to be far simpler, but IMHO, insecurity because of all of the FUD that this sort of article prescribes, has meant that the language has bloated to incorporate all sorts of syntax improvements and new patt…

>It's not a systems programming language, so all the comparisons against typed, compiled languages are moot. No they are not 'moot'. At least not if you're building applications with 100k+ LOC. For dinky websites and small projects I'm with you. >Introducing transpiling as a mandatory pattern for JS development was a mistake. Again, what are you building? A dinky website, or a large application that you'll have to ma…

10 years??

You will have to refactor everything and entirely change your toolchain every two years. If you had the misfortune of using some framework, it will no longer be supported by then.

No JS application has that kind of longevity, because the entire ecosystem is extremely volatile.

Re: JavaScript is Good, Actually

#256
post #223

Code spends most of its time being in production and not in development. During that time in production, developers will leave the team, bugs will show up, major enhancements will be made. So it is important that the codebase is easy to reason about, easy to refactor and easy to debug. If you take a language like Java and an IDE like Eclipse or Intellij IDEA, it is trivial to find from where a particular piece of cod…

TypeScript offers a compelling case, however. It often can provide the refactoring superpowers of strong statically typed languages on top of JS, and its brand of structural typing allows for quite expressive, but type safe, programs.

That being said, TypeScript is not sound and obviously in a real TypeScript program you'll eventually touch things that are untyped. But still, getting a different set of trade-offs than "statically typed" and "dynamically typed" is useful. It makes me wish there was something like this for Python (no, MyPy and Pyre are not this. They only provide nominal typing, which is definitely not good enough for everyday Python like Django.)

Re: JavaScript is Good, Actually

#257
post #159

Earlier quoted context omitted.

> It is also really slow 1) In scientific/ML CPython libraries, most critical parts are compiled anyway, and the core language is fast and expressive enough to provide a nice and fast interface to it; so your statement makes little sense without more context 2) Python != CPython

While I use Python for ML myself, I find it weird to say that a language isn't slow because you don't really use it anyway. It's true that Scripts in Python can be fast if 99% of the executed logic is in C anyway but that doesn't mean the language isn't slow. As soon as your Python script needs to do anything not available in a library you'll notice how slow it really is. Python is really neat to quickly experiment p…

That python is slow is utterly irrelevant. You would never deploy an unoptimized Python codebase into production if you cared about performance. You would profile the code and optimize the hot paths with the appropriate technology, be it numba-jit, cython, numpy, cffi, or any of the other many ways you can easily optimize Python

Re: JavaScript is Good, Actually

#258
post #94
post #71

Earlier quoted context omitted.

What are great languages in your opinion?

If we’re talking about “dynamic CRUD over socket abstracted to death”-style tasks, and not considering minor preferences like syntax, then python, lua, most of lisp/schemes, perl. All of these allow enough meta-anything to do: ./file.src: func api_foo() for x in objs x.a = fetch(x.b) ui.btnok.enabled = yes commit() And have foo exported as api, and when called, all clients/servers, databases synced, validations passe…

The criteria for this list of languages seems to have been "isn't JS". The story for metaprogramming in JS certainly is limited in some aspects; for example, there's no operator overloading and JS isn't homoiconic like lisps, but between dynamic inheritance in older JS and the newer additions like proxies, symbols, accessors, reflection API, protocols and being able to extend the 'exotic' behavior of arrays, JS can probably still do whatever the snippet you posted is supposed to illustrate.

As a concrete example, here's a library I made that relies on symbols and dynamic inheritance to extend the built-in data types: https://github.com/slikts/symbol-land

Re: JavaScript is Good, Actually

#259

Earlier quoted context omitted.

I don't know, getting people to run my Python code currently consists of "make sure you have Python 3, run `pipenv install`, run the code".

And if every Python developer, researcher using Python, etc, did that, it would be much less of a problem. The reality is, many, many don't. It's kind of ironic, really. With the Zen of Python stating "There should be one-- and preferably only one --obvious way to do it" why is it that it's so common for people to not do the thing that makes it reasonably portable? I mean, I currently am working with some code that,…

The Zen of Python does not extend past the language itself, unfortunately.

Re: JavaScript is Good, Actually

#260
post #223

Code spends most of its time being in production and not in development. During that time in production, developers will leave the team, bugs will show up, major enhancements will be made. So it is important that the codebase is easy to reason about, easy to refactor and easy to debug. If you take a language like Java and an IDE like Eclipse or Intellij IDEA, it is trivial to find from where a particular piece of cod…

Nope. I’ve worked in Java codebases which are much worse than your average js codebases. You could never tell what part of the java code calls which genericized listener. Especially with all the floating xmls and linked annotations. Its not the language, its the design that matters.
Post reply on HN