Live data from Hacker News

Structure and Interpretation of Computer Programs – JavaScript Adaptation

sicp.comp.nus.edu.sg

71–80 of 188 posts

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#72
post #43

Earlier quoted context omitted.

This rebuttal isn't worth much, as it was written back when js was a much different language, some 2 years before let/const, promises and probably half of what modern js developers use day-to-day. It is also way too snarky to take it seriously. Not gonna lie, it was a fun read though.

yeah, that's why it's not such a minimal language anymore.

[deleted]

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#73
post #49

Every now and then a great movie comes out. Then it gets its American remake. It's been proven you can put Al Pacino, Robert de Niro and Bruce Willis in any movie (with predictable results!). This is the book equivalent of an American remake for me. Is Javascript the new pseudocode? Honestly I'd rather be forced to learn a new language to understand a book than to read the book adapted to JS.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

Yes, it's such a great language that `{} + []` is a valid program.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#74
post #55

What an interesting and ambitious project! Of course the first thing I did was skim the Metacircular Interpreter section to see how they handled the additional syntactic complexity. They gloss over the "parse" function, which is probably the best one can do. That the Scheme function "read" could be implemented by a novice is one of the advantages of using Scheme for SICP and it wouldn't be reasonable to expect an ada…

> The translation is pretty direct, so the data structures are more idiomatic to Scheme than they are to JavaScript. I think that's OK.

I do wonder if it wouldn't be simpler to write a Scheme interpreter in JS (or take one of the undoubtedly existing ones) and make the book interactive with that.

This version feels more like something that has added value if you already know JS, not so much when you're learning JS

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#75
post #49

Every now and then a great movie comes out. Then it gets its American remake. It's been proven you can put Al Pacino, Robert de Niro and Bruce Willis in any movie (with predictable results!). This is the book equivalent of an American remake for me. Is Javascript the new pseudocode? Honestly I'd rather be forced to learn a new language to understand a book than to read the book adapted to JS.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

It's useful and practical and has a lot of work put into it so it can't really be called bad, but it doesn't really stack up to what native languages can provide at the high end, and never will (even if it can get pretty darn close).

Though I acknowledge its immense utility, I feel like JS always tends to go for "good enough" solutions rather than "best in class" solutions. That is its own kind of quality, but there's good reason to dislike JS for people who focus on those particular qualities in a language.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#76
post #49

Every now and then a great movie comes out. Then it gets its American remake. It's been proven you can put Al Pacino, Robert de Niro and Bruce Willis in any movie (with predictable results!). This is the book equivalent of an American remake for me. Is Javascript the new pseudocode? Honestly I'd rather be forced to learn a new language to understand a book than to read the book adapted to JS.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

The meaning of the second paragraph was ambiguous. Aside from Javascript dislike, which I don't pretend to deny, I believe learning new things is mind-expanding.

When an intriguing movie - or book - comes out, it's often intriguing because it's quite different. When you convert it to a common language - or Hollywood - it becomes less different. Reading "Working With Legacy Code" forced me to absorb some C#, but it also allowed me an opportunity to compare it with Java, which I learned at university.

What I understand from this is that people didn't really value Python as a pseudocode language. It was just fashionable at the time. Now it's Javascript's time. I wonder what's going to be next? Golang has a chance.

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#77

Earlier quoted context omitted.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

Yes, it's such a great language that `{} + []` is a valid program.

What an extremely weak criticism that has been played out.

1) Don't concatenate them in the first place

2) Use TypeScript

Pro-tip, if the world is going JS and you don't get it, it's probably you.

With JS (TypeScript) I can develop on every platform natively (React Native).

I can compile to native code. (AssemblyScript).

I'm not saying you can't do those things on other languages, but JS is becoming a powerhouse thanks to it's ecosystem.

Also, you see many other communities like Rust copying lessons learned from web developers (React/Redux/etc)

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#78
post #49

Every now and then a great movie comes out. Then it gets its American remake. It's been proven you can put Al Pacino, Robert de Niro and Bruce Willis in any movie (with predictable results!). This is the book equivalent of an American remake for me. Is Javascript the new pseudocode? Honestly I'd rather be forced to learn a new language to understand a book than to read the book adapted to JS.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

> JS is a great language

literally no one believes this

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#79

Earlier quoted context omitted.

Typical dramatic Hacker News user. JS is a great language and enjoyed by millions of developers.

Yes, it's such a great language that `{} + []` is a valid program.

Do you find yourself accidentally doing that often? A few of the things from the "Wat" video fall into that category. "Things no one would have ever thought to try, yet a dynamic language will fully allow". If you want to point out valid concerns with JS, the double-equal implicit coercion is a far more frightening "gotcha".

Re: Structure and Interpretation of Computer Programs – JavaScript Adaptation

#80

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…

Simple question: do you know enough lisp to write a self hosting interpreter in it? People talk up their language until they learn lisp then this happens: https://www.draketo.de/proj/py2guile/

"Do you know enough lisp to write a self hosting interpreter in it?"

Short answer: Yes.

Long answer: No!

I learned Lisp and TI-Scheme in the early 80s, and somewhere around then we did some SICP-like stuff in undergrad CS.

I later came upon SICP and worked my way through it, having the usual "Aha!" moments. I thought I knew something about Lisp and Scheme at that point. I built some self-hosted interpreters using the following pattern:

1. Write an interpreter for a minimal subset of Scheme in a host language.

2. Write an interpreter for a more full-featured Scheme in the subset of Scheme.

At some point, I read LiSP [0], and I discovered that what I thought was enlightenment was actually but a hint of the delights to come. The entire book is about teaching programming through the device of building interpreters and compilers.

So my next pattern was something like:

1. Write a minimal Scheme interpreter in a host language.

2. Write a Scheme compiler in Scheme.

3. Bootstrap the compiler by running in in the interpreted Scheme.

4. Now you have a compiled Scheme implementation written in Scheme.

5. Build out more features.

And now, this approach is one of my go-to tools. A few years ago, I was playing with Turing Machines, and I used a "constructive proof" approach: If we want to demonstrate that a Turing machine with tape that has one end is just as powerful as a Turing Machine with a tape that stretches to infinity in both directions, write a compiler from one kind of Turing Machine to the other. And so on and so forth to prove that being able to write an infinite number of different symbols is no more powerful than writing 0s and 1s. Or that a multi-dimensional Langdon's Ant is no more powerful than a Turing Machine...

Interpreters and Compilers are very powerful tools for constructive reasoning.

But the point of the discussion around Scheme for this purpose is how easy it makes writing Interpreters and Compilers. On the one hand... Shrug... Since we can write interpreters and compilers in any language.

On the other hand, a tool that removes a lot of the accidental complexity in writing interpreters and compilers changes the way we think about writing interpreters and compilers, much as parsing text using a language built around pattern matching (like SNOBOL and its descendants) changes the way we think about parsing text.

So... We are probably in deep agreement about the value of SICP in Scheme, and the value of Lisp in general, not just as a language, but as a way of changing the way we approach solving problems.

And as for knowing enough... The truth is, every time I sit down with certain programming ideas, I learn more and realize that what I thought I knew was incomplete.

So in a very real sense, I suspect that no, I don't know nearly as much as I think I know.

---

[0]: Lisp in Small Pieces: https://www.amazon.ca/Lisp-Small-Pieces-Christian-Queinnec/d...

Post reply on HN