Definitely true for Golang, learned a ton reading its stdlib (and even found a bug this way)
I actually partially disagree with this. Sure, for the higher level OS independent packages (e.g. “archive/tar”) this is great. For stuff in the “os” package it’s a different matter. All of that code is a bit messy. Not because the authors did a bad job, but simply because it’s hard to implement the same API on half a dozen operating systems. Then there is the “runtime” package which relies on a lot of global state,…
To learn a new language, read its standard library
101–110 of 243 posts
Re: To learn a new language, read its standard library
#102* Looks around nervously in JavaScript *
Re: To learn a new language, read its standard library
#103laughs in C++
I learnt more about C and C++ from studying Plauger's The Standard C Library and Plauger/Stepanov's The C++ Standard Template Library. I also remember learning Object-Oriented Framework design from MFC Internals.
Re: To learn a new language, read its standard library
#104This is a classic academia-ish take. Consume a bunch of theory and regurgitate whatever you've read. Better way to learn is making stuff with the language, having actual skin in the game. Only then bounce back to theory on the more nuanced stuff.
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 whether that code is idiomatic. But my case still stands regarding concrete vs. abstract.
Re: To learn a new language, read its standard library
#105IMHO, 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 is novel about Go? It just seems like C repacked with a garbage collector and basic concurrent programming support to me. Which both weren't novel even when Go was designed.
Re: To learn a new language, read its standard library
#106Earlier quoted context omitted.
> In rust the standard library uses quite a bit of unsafe code, and even nightly only features and standard-library-only features that you don't usually need in real code I have found the Rust std lib to be a great resource. Much of the unsafe is necessary because there is literally no other way to build up abstractions like Box or certain data structures without it. Obviously once those are written though, you want…
Do you know of any examples of good quality application code in rust?
Re: To learn a new language, read its standard library
#107Earlier quoted context omitted.
LLVM implements fewer optimization passes for ARM, so it's doing less work than compiling for x86.
Does that hurt performance of the output?
Re: To learn a new language, read its standard library
#108To anyone that considers this approach for learning C++, I would advise strongly against it. Standard library code has to deal with too many cases and tries to be optimal for as many of them as possible. Also the formatting is highly unusual, compared to other C++ code found in the wild.
Re: To learn a new language, read its standard library
#109Whole heartedly agree. I was big into Go years ago, and some newer guys tried to make it a functional language. When they argued with me, I couldn't say 'its's just not right', but instead pointed them to std library code. Protip: That doesn't change their mind, it just makes them hate Go.
Together with that, I agree that one should read the high literature before inventing a new writing style.
Re: To learn a new language, read its standard library
#110Whole heartedly agree. I was big into Go years ago, and some newer guys tried to make it a functional language. When they argued with me, I couldn't say 'its's just not right', but instead pointed them to std library code. Protip: That doesn't change their mind, it just makes them hate Go.
Why is that wrong? A language can be multi-paradigm while the “official” documents are written in a specific style. Like human languages, they evolve with their use (or fork into another language completely), while the high literature is the last one to change. Together with that, I agree that one should read the high literature before inventing a new writing style.
If you don't like language X, don't take a job writing language X.