5 ms·
Reading the source code is very helpful if you are an experimented programmer that already grasped the basics of the language. It helps you to see what are the
by iTokio 5y ago
Reading the source code is very helpful if you are an experimented programmer that already grasped the basics of the language.
It helps you to see what are the idioms, what does optimized production code look like.
Compare C++ and Go std lib and it’s easy to constate the difference in language goals that they have.
- stathibus 5y agoReading the c++ stdlib source code is never a good idea.
- FpUser 5y agoROFL. Yup. When I look at application level codes those are nice. Looking at stdlib makes me want to walk away immediately.
- einpoklum 5y agoIt's not a fun experience to be sure, but: 1. It's useful when you want to check the exact under-the-hood behavior, to figure out side-effects or corner-case semantics. 2. After a good number of years, that code becomes less scary and more icky. Some of it remains kind of scary though... 3. Reading that code teaches you a lot about considerations you may be ignoring, especially your implicit platform-dependent assumptions. 4. Nitpick: There isn't any single C++ standard library source code, it's at least 3 popular ones (GCC's libstdc++, LLVM's libc++, and Microsoft's)
- pjmlp 5y agoIncluding the workarounds Go has gone through due to lack of generics, e.g. sync.Map.