Live data from Hacker News

To learn a new language, read its standard library

patshaughnessy.net

141–150 of 243 posts

Re: To learn a new language, read its standard library

#141

Interestingly, my engineering school adopted the opposite approach on practical teaching: the first couple of month after the preparatory years were all about re-building all the C stdlib, networking layer, then building your own shell, then building your own assembler and corresponding vm (it was an assembler for a quartet based system for whatever reason), then compiler for a random language in c++ (tiger) and so f…

By random language do you mean probabilistic? That sounds pretty advanced, actually.

Re: To learn a new language, read its standard library

#142
It can give you some insight into language features, memory model, etc, but it is unlikely to help you "learn" , as in "be effective in using" it.

For instance in Scala you'll likely need to know cats-effect or zio ecosystem more than stdlib. Likewise for Rust, where futures and async stack (tokio, asyncstd) are outside stdlib.

Re: To learn a new language, read its standard library

#144
post #119

Earlier quoted context omitted.

I don't think this is a good read. A standard library is very concrete - it's the core of the language in action, and the shape that its code takes will likely be repeated regularly in 3rd party code written in that language. There's nothing academic or abstract about it. EDIT: As others note, a good chunk of a stdlib may involve system interop that isn't representative, so that tempers my comment with regards to whe…

Here is a basic structure implemented in C++: https://github.com/llvm-mirror/libcxx/blob/master/include/ve... I would not recommend anyone ever look through that as a way to learn C++. Heck just something as basic as a struct that stores two member variables is a 200 line of code horror show in C++: https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b501...

Well, that's still instructive about how library code that aims to be efficient and portable has to look in C++. It's not representative of most application / business layer code, and it's definitely not good learning material.

But, if choosing C++, at some point you will have to write code like that as a project matures and must target different compiler versions and platforms.

Re: To learn a new language, read its standard library

#145

IMHO, any language worth learning has a large enough user base in both corporate and academic settings and that there are books written on it. That's my criteria. If it doesn't have at least 5 books on Amazon, I'm suspicious of it (and from real publishers, and not publishing mills). There's too much wheel-reinventing happening for me to get excited about new languages. In the last decade I've spent time learning fiv…

What's the difference between a real publisher and a publishing mill ? How would you categorize No Starch Press, Manning, OReilly as per this rubric ?

As someone who reads 10-20 tech books per year I rate PragProg the highest, then O’Reilly, though not everything is of the same quality there. PacktPub is absolute trash tier. Don’t remember others you’ve mentioned as good or bad

Re: To learn a new language, read its standard library

#146
I think this applies to lot of frameworks, especially web frameworks. This has been my experience with expressjs and Angular2, Jquery. They may look like they are doing lot of magic but underneath it’s just a simple code, when read it easy to write optimised code.

Re: To learn a new language, read its standard library

#147

I had a friend who said he enjoyed reading the PickAxe Book ("Programming Ruby") from end to end each year . That includes the whole Ruby stdlib!

I still love Ruby, whereas I have only learned how to be a good colleague with PHP, Java, and JS.

how so?

Re: To learn a new language, read its standard library

#148
post #17

Ugh Crystal is so beautiful and sorry to make this typical complaint but I wish the compile time was 1/10th of what it is. The dev cycle loop is just not there for me but the language is incredible.

Does Crystal benefit from these new M1 beasts? My Rust compile times became much more pleasant.

Compile times on M1 seems to be fairly nice yes, according to those that have tested. But it is still perhaps not what one could wish it to be. So far most of the efforts in the compiler seems to be around making it correct, rather than faster.

Re: To learn a new language, read its standard library

#149
post #21
post #14

Earlier quoted context omitted.

Re-implement a toy version of the framework from scratch. :-) Or, try to add a non-trivial feature to the framework.

How do you know what a "toy version of the framework" looks like when you're not experienced with the framework itself? It seems to me like you've already solved the issue of "learning the framework" if your mental model of the framework is that solid.

Perhaps by addressing the issues that led to you adopting the framework?

Re: To learn a new language, read its standard library

#150
"The best way to learn a new programming language, just like a human language, is from example."

Certainly this is how I learn. Much more immediately useful than voluminous documentation.

However I am not sure every language has a standard library.

For example, Lua.

Also not sure every standard library is a model to follow.

For example, where feasible, I try to use and learn from djb's C functions instead of the "C standard library" ones.

Post reply on HN