Live data from Hacker News

Structure and Interpretation of Computer Programs – JavaScript Adaptation

sicp.comp.nus.edu.sg

181–188 of 188 posts

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#181

Earlier quoted context omitted.

Of course SICP is brilliant in Scheme. But hello? There is no such thing as a “blub language.” Your comment misrepresents the entire point of the original PG essay! The point is that givens some fictional language called “Blub” for the sake of the essay, some programmers believe that their language has everything that could possibly be useful, productive, expressive, &c. But PG’s contention that languages exist on a…

Considering everything is being shoved into the web paradigm and written in JS even when it's wildly wrong for the job, I think it fits the description perfectly.

> even when it's wildly wrong for the job

Oh, are you the great decider who decrees what we can and can't use certain programming languages for?

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#182

Earlier quoted context omitted.

Considering everything is being shoved into the web paradigm and written in JS even when it's wildly wrong for the job, I think it fits the description perfectly.

> even when it's wildly wrong for the job Oh, are you the great decider who decrees what we can and can't use certain programming languages for?

No, but JS certainly wasn't designed for what it's been retooled into doing now. Neither is HTML.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#183
post #106
post #35

Earlier quoted context omitted.

Can lisps place arbitrary code in types and formally verify complex properties of stateful systems--all in the same language? Doubt it. Lisp isn't the epitome of power.

... Yes. Of course they can. Lisp is usually an academic language, which means research into type systems and type safety frequently takes place in it. ACL2 is a theorum prover written in Common Lisp [0]. And not just a random project either, but something AMD, ARM, IBM, etc. have used. [0] https://en.wikipedia.org/wiki/ACL2

This is not a practical language with dependent types tho lol

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#184

Earlier quoted context omitted.

For sure, if you have a shot at making a world class system you probably don’t want JS. But I’ve never been in a job where we had a shot at building a world class system. Maybe I just have bad luck, but at each place I have worked the problems in the codebase are obvious and the impediments are institutional not technical. There are hundreds of problems I could list in our current codebase that are causing slowdowns,…

The problem is that if the system was world class then it might actually be ok if it was in js. Most codebases are a bit of a mess, like you say, and js just makes it much harder to figure out what is going on. It's not just a dynamic language, it seems to encourage a gratuitously dynamic style. So you have to figure out everything in the debugger. That is if you can even determine where to set a breakpoint!

Yeah, I actually agree with you especially for ES6. Because it requires you to transpile, and because promises/async/await break the control flow model, it is extremely difficult, often impossible to place breakpoints. With await in particular, you can forget to await a promise and then your app just stops working, mysteriously, and there’s no way to find out what’s happening except to one by one disable parts of the app until the situation becomes clear.

Transpilation as a norm means it’s kind of 50/50 whether the source code you encounter while debugging will even be readable.

Actually what I see most often, professionally, is that JavaScript developers stop believing they can inspect their application at all, and when something is wrong immediately just try to guess what’s happening. Then see if their imagined fix helps, if not try again. Basically guess and check. Which is a fine technique but it’s pretty bad if that’s your only way to debug problems.

I am able to code in ES5 sometimes on independent projects (without Webpack) and it’s a joy. The debugger works everywhere, in a consistent way. I have callbacks everywhere so asynchronous code is simple to trace and easy to understand. It’s great.

I am working slowly towards a fork of NPM/Node ecosystem that starts over before ES6. I think early JavaScript is actually a wonderful, fast, elegant language.

I would say that ES6 is so bad in terms of debuggability that you almost have to use TypeScript to make coding in ES6 bearable.

The other aspect of what you’re saying: that you have no static analysis tools so you HAVE to debug, is spot on. I think to build a great JS application you have to put an equal amount of effort into designing the test harness. Basically all the time you would have spent wrangling the type system you have to put into the tests.

And you can’t just half- ass the tests. They need to really accurately mirror your business needs, and really model the relationship between your app and your tests, in order to provide an equivalent static analysis value to what a type system would give you.

However one final point, which is that the fact that ES5 is so impoverished in terms of control flow and data modeling, I think actually helps solve all of these problems. If you limit yourselves to basically just functions and literals, you are forced to write really strong clean interfaces. I find myself being able to focus almost entirely on separation of concerns. Because I’m not dealing with fancy language features, and because I literally can’t afford to build giant complex modules and applications, it forces me to build small, simple modules that have very clear responsibilities.

That might seem like a limitation to many, but I actually find it helps me to avoid headaches before they happen.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#185

Earlier quoted context omitted.

I love ES5. The language has gone downhill though.

Now thats an unusual viewpoint? Could you elaborate why you think so? I personally found js terrible before es6 and love it since then

Here are some things I find problematic: https://news.ycombinator.com/item?id=21848597

But I’m happy for you that you like ES6. You all own the language now, so enjoy it. Us ES5 folks are going to have to rewind and fork so we can have a community again.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#186

Earlier quoted context omitted.

Of course SICP is brilliant in Scheme. But hello? There is no such thing as a “blub language.” Your comment misrepresents the entire point of the original PG essay! The point is that givens some fictional language called “Blub” for the sake of the essay, some programmers believe that their language has everything that could possibly be useful, productive, expressive, &c. But PG’s contention that languages exist on a…

Considering everything is being shoved into the web paradigm and written in JS even when it's wildly wrong for the job, I think it fits the description perfectly.

If you really want a blog post to describe how JavaScript is eating the world, I suggest it isn’t “Beating the Averages” by Paul Graham.

It’s actually “Worse is Better” by Richard Gabriel. I don’t think people are writing JavaScript tooling while saying that JS is just as powerful as Haskell or Lisp. What they’re saying is that its ubiquity is valuable and for their use case, ubiquity and network effects trump productivity and/or “power” however we might want to define them.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#187
Finally have a free 1 hour and try the site. The site cert. is not valid ... and also if you start with the book, click it does not result in running code. More important the first preface is about Scheme which I think it should be in reverse. My 1 hour up. May try later.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#188
post #35

Earlier quoted context omitted.

Can lisps place arbitrary code in types and formally verify complex properties of stateful systems--all in the same language? Doubt it. Lisp isn't the epitome of power.

Yes. That's the point, you will write the dsl to do that in scheme. Then use that to solve the original problem. Abstractions on top of abstractions.

No. You can write a compiler for any language in Scheme, but it's disingenuous to say that Scheme has that language's features. There are many languages with way more powerful features than Scheme if you're comparing type systems.
Post reply on HN