[HN Gopher] To learn a new language, read its standard library ___________________________________________________________________ To learn a new language, read its standard library Author : sferik Score : 58 points Date : 2021-10-24 06:38 UTC (16 hours ago) (HTM) web link (patshaughnessy.net) (TXT) w3m dump (patshaughnessy.net) | epolanski wrote: | What would the JS/TS equivalent? | baby wrote: | Definitely true for Golang, learned a ton reading its stdlib (and | even found a bug this way) | askvictor wrote: | I find languages are pretty easy to pick up after the first few. | What seems to be the barrier nowadays is frameworks. How do | people go about learning a new framework? Obviously most of them | have an intro project to follow on with, but they tend to be | pretty simplistic, and once that's done, getting to the | complicated bits that you actually want to implement seem to be | the barrier. | marginalia_nu wrote: | I usually prefer working with mature stacks that don't require | me to constantly work with flavor of the month frameworks. | | It's great to broaden your horizons and all, but that is | something that needs to be done judiciously and deliberately if | it is to actually be of any use. | trevyn wrote: | Re-implement a toy version of the framework from scratch. :-) | | Or, try to add a non-trivial feature to the framework. | munchler wrote: | This doesn't seem like a great idea in general, since the | standard library is usually low-level code, aggressively | optimized for speed, that is not at all typical of applications | written in that language. | dxuh wrote: | To 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. | dataflow wrote: | Yeah... for C++ it's more like s/To learn/To _really_ learn / | aetherspawn wrote: | Uh yeah if you try and read the Haskell standard library, | you're screwed. It's list fusion and fancy algorithms to hack | asymptotics all the way down. | eepp wrote: | thank you | bestinterest wrote: | 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. | trevyn wrote: | Does Crystal benefit from these new M1 beasts? My Rust compile | times became much more pleasant. | cturtle wrote: | I'm using Zig a lot right now, and I have been pleasantly | surprised by the standard library. Maybe it's due to Zig being a | very straightforward language, but I find most everything I read | in the standard library to make immediate sense. | | I don't know about reading std alone to learn Zig though, I used | other sources like ziglings and ziglearn which taught me syntax | and patterns. Had I started with the standard library I doubt I | would have picked up the language as quickly as I have. | | So having learned Zig I am much more inclined to look at standard | libraries for languages I learn in the future, but I don't think | it's wise to rely only on standard libraries for learning. | andy_ppp wrote: | Elixir's standard library is incredible and so simple and 99% | written in Elixir. | Waterluvian wrote: | Reading the Python stdlib was a brilliant move a peer encouraged | me to do. I learned three themes of stuff: | | 1. A good look at long lasting, durable pure python. | | 2. A good look at long lasting, durable C implementations of | python (dict is the core of Python. Read the source!) | | 3. A look at a bunch of libraries that basically never get used | and a sense of how they compare to popular third party libraries. | (Doing this is why I'll never complain when a language's stdlib | is small. I get it now.) | mberning wrote: | All well and good until you find out half of it is written in C | or something like that. I like to go out and find the most | starred repos on github or just ask around for a library that | people think highly of and read that. | marginalia_nu wrote: | C itself is actually a pretty good example of where this fails | as well. Its standard library is usually more macros than code. | It's necessary if you are going to ship portable code that | deals with every conceivable architecture and endianness and | permutation of toolchain from 1976 until now, but it's not how | most C code looks. | | K&R is a much more meaningful guide than unistd.h. | synergy20 wrote: | Until you realize most of the time the code is loaded with | Macros, ifdefs, cross-platform | conditions(windows,macos,linux...), hacks for different versions | of OSes/dependency/whatever, the real meat is hard to spot on, | it's easy to get lost in those noises. ___________________________________________________________________ (page generated 2021-10-24 23:00 UTC)