Live data from Hacker News

Eloquent JavaScript 4th edition (2024)

eloquentjavascript.net

81–90 of 249 posts

Re: Eloquent JavaScript 4th edition (2024)

#81
post #39

Someone asked about integer support in JavaScript. JS now supports BigInt! >2**57 144115188075855870 >2n**57n 144115188075855872n

Oh thank god.

I've been having to do some hacky things to represent numbers on an astronomical scale for my star system/planet generators.

Re: Eloquent JavaScript 4th edition (2024)

#82
post #75

Earlier quoted context omitted.

yes, also javascript the good parts is really good(hehe) because it's more theoretical and there is not html or web stuff in it just the language

How recently have you read it? I thought it was a worthwhile read when I first read it 12 years ago, but I picked it up to skim a couple years ago and was struck with how much of it was irrelevant for modern JS due to changes in the language spec.

In that sense an annotated "this is what JS used to be when this book first came out" version could be of historical interest.

Re: Eloquent JavaScript 4th edition (2024)

#83
post #7

Earlier quoted context omitted.

> I am definitely going to recommend they write TS instead of JS Why is that? If you want them to learn JS, teach/recommend them to learn JS? Compile-to-JavaScript languages come and go, but JavaScript has remained. First learning vanilla JavaScript makes sense, and then add TS on top if you really have to. At the very least they'll be prepared for when TypeScript goes out of favor.

Because TypeScript is the de facto standard way of writing JavaScript for most of the industry and it has killed all of the other compile-to-js languages. The chances of it going out of favour are very slim, there's a giant ecosystem built on it and the language is very well loved by devs (should be second only to Rust). Microsoft has 50 people on payroll working only on TS. Any competitor needs a gargantuan investme…

I use TS, I like it.

I'm not sure you're 100% right about it overtaking JS for most of the industry.

I wouldn't recommend it to beginners until they've learned JS because it's a lot of stuff to learn on top of JS to achieve basically the same outcomes (with fewer bugs). Chapter 5 in the Eloquent JavaScript book gets to higher order functions, which in TS means Generics. Nobody needs to learn Generics in Chapter 5 of their programming journey.

You also don't really appreciate how useful TS is until you've battled at least one project in plain JS.

(Arguably you can go a long way without HoF too, but perhaps not if you're hoping to understand other people's code.)

Re: Eloquent JavaScript 4th edition (2024)

#84
I'm currently going through a hard copy of the book's third edition. But I'm wondering whether the description of the language in the book is detailed enough. Could you share some opinions on whether it will be good to go through some other JavaScript books after it? I'm considering going through "JavaScript: The Definitive Guide"[1] or "The Modern JavaScript Tutorial"[2] after it.

[1] https://www.amazon.com/JavaScript-Definitive-Most-Used-Progr...

[2] https://javascript.info/

Re: Eloquent JavaScript 4th edition (2024)

#85
post #78

Earlier quoted context omitted.

"binding" is a PLT term, denoting the association between a name and a value. It's a higher level concept than the variable - a mutable binding is what people usually refer to as a variable, and an immutable binding is the correct term for what people refer to an "immutable variable" (an oxymoron, if you think about it).

Immutable variable isn't a oxymoron. It can still vary between instantiations. If you have (a)=>{const b = a}, b can have different values even though it can't be reassigned.

In the case of the code that you have cited, these are all different elaborations of the binding at the invocation of the lambda, due to the interplay between activation records and scope rules.

It's not really an "immutable variable" - it's a local binding getting bound to different values on each scope entry.

EDIT: By the way, the `b` binding in your code can be modified. Did you mean `const b = a;` ?

Re: Eloquent JavaScript 4th edition (2024)

#86

Earlier quoted context omitted.

Because TypeScript is the de facto standard way of writing JavaScript for most of the industry and it has killed all of the other compile-to-js languages. The chances of it going out of favour are very slim, there's a giant ecosystem built on it and the language is very well loved by devs (should be second only to Rust). Microsoft has 50 people on payroll working only on TS. Any competitor needs a gargantuan investme…

Flow has about a dozen of important features that typescript lacks (while being 10x smaller in terms of LoC).

Flow is basically a dead project outside of Facebook.

https://npmtrends.com/@babel/preset-flow-vs-flow-bin-vs-type...

Re: Eloquent JavaScript 4th edition (2024)

#87
post #49

Earlier quoted context omitted.

It's a great explanation, but I've never heard the term 'binding' used to describe variables. It's usually reserved to function binding or bridge APIs like the DOM. The tricky thing is that "boxes" are the right abstraction for primitive values. After that you need to explain how references work, and that's pretty much the same 'tentacle' concept. This method spares the reader one step, but might cause confusion once…

"binding" seems like a more casual term for memory pointer. I guess if people are just getting started with programming it make sense to simplify things a bit.

My point is that it's not a simplification, it's precisely how the language works: bindings between values and names (JavaScript has no separate notion of memory pointer; everything is a "pointer"). (Similarly for Python: https://nedbatchelder.com/text/names1.html) Describing variables in this way gives readers the correct understanding, and the analogy of tentacles is no harder than that of boxes. Such things are what I most appreciated, that the author manages to be approachable without sacrificing accuracy.

Re: Eloquent JavaScript 4th edition (2024)

#88
post #86

Earlier quoted context omitted.

Flow has about a dozen of important features that typescript lacks (while being 10x smaller in terms of LoC).

Flow is basically a dead project outside of Facebook. https://npmtrends.com/@babel/preset-flow-vs-flow-bin-vs-type...

Not that I think download metrics is the best metric to decide that, but even with that, flow-bin has almost half a million of downloads per day. That's far away from dead, at least in my world. And I'm guessing that doesn't count anything from Facebook as they most likely run their own registries.

Re: Eloquent JavaScript 4th edition (2024)

#89
post #65
post #45

Earlier quoted context omitted.

It's better if they learn the core language and then graduate to TypeScript (if at all, as there's active discussion of adding type annotations to the core language [1]). An anecdote: I was sold a similar story on CoffeeScript back in the day, stressed myself out learning it, only to discard it a couple years later. TS won't have an identical fate as its shepherded by Microsoft, but eventually it will go the way of t…

This was the approach one of my first mentors recommended and it's served me well. Learn the core language and its features and then add tools/frameworks as needed . Lately it feels like we're teaching new devs popular frameworks and completely ignoring the fundamentals.

Yep. But business requirements dictate what happens and these frameworks are the fastest way to achieve business goals, which sucks as when the frameworks lose their appeal, those devs are gonna struggle to transfer their skills to something else.

Re: Eloquent JavaScript 4th edition (2024)

#90
post #38

This is, in my opinion, the book to use to learn JavaScript at more than a surface level. The only other materials I recommend as much (but for a different level of learner) are the “You don’t know JavaScript” in-depth book series. In 2015, I was consulting for a distance learning program, administered by a major California University, that wanted to replace their current textbook (one of those “Head First” O’Reilly…

+1 for "You don't know js", it's a must read for any js programmer IMO.

I haven't read eloquent JS though, you say it's a different level of learner. Can you expand a bit? Is Eloquent for after "you don't know js" or vice-versa?

Edit: nevermind, reading the TOC of eloquent JS gave me a good enough idea

Post reply on HN