Live data from Hacker News

To learn a new language, read its standard library

patshaughnessy.net

151–160 of 243 posts

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

#151

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 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.

Go doesn't have any substantial innovations in the set of language features, or maybe none at all. I believe it is instead the whole of a sober and efficient toolchain that effects tedious but simple to understand and work with code, which gave it such a great appeal.

It's like a modernized C with a good implementation and out-of-the-box no-nonsense tooling, and the tricky bits left out. Nothing really new to see, but there was nothing really like it when it took off. Very utilitarian. Rust, Java, C#, C++ - those are all very 'complex' or 'bloated' in many different ways to an avid Go programmer.

I'm not promoting Go (I personally don't like it), I'm just trying to understand it's appeal and popularity and what is different about it. Quality and completeness of implementation, tooling, etc. by having a big company behind it also helps of lot of course - but it isn't sufficient.

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

#152
post #122

Whole 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.

Hm, by that measure no one would write OOP in C++.

which would be fine because C++ is not an OOP language ?

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

#153
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...

Here is a basic struct that stores two members in C++:

struct foo { int a; int b; };

That's all. The thing you refer to is not a 'basic struct', it's complex standard library component.

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

#154

Earlier quoted context omitted.

If it drove them to write in another language, might that be a win? A code base full of non-idiomatic code, where devs think in the style of language A while using language B, isn’t a great place to hang out.

It absolutely would be, if our entire stack wasn't in Go. One was a JS guru who literally threatened 'I can walk across the street and get another job, you know.' And we let him, and both of us are happier for it. So I do agree, don't join a team writing a language you hate.

I think I would have left too. Go has its advantages to be sure, but if you can write highly expressive functional code in a language like JS, Go is like wading through a swamp.

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

#156
post #139

> To learn a new language, read its standard libraryTo learn a new language, read its standard library Yes, but also no. The standard library is often more complex and uses more advanced features then you often need for most projects. I.e. collections in std are supper general purpose, but if you need to write a collection it's normally specific to the purpose you need it for. I.e. std is the "most" general purpose l…

Or it even uses patterns which would be considered anti patterns outside of it for the sake of optimizations.

For older languages, it’s also pretty common for some of the stdlib’s corners to be very dusty with API design, naming conventions, and coding patterns considered at best way outdated.

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

#158

Completely agree. Once you learn enough languages, it all starts blending together and looking more or less the same. Same control structures, same functions, same structures, same classes, same objects, same lists, same hash tables, same pretty much everything. There's usually a few innovations and peculiarities here and there but it's not that much. The bulk of the language is actually the standard library. The API…

I think the Scheme quote is interesting, because it almost applies to C.

Most people consider learning C hard (for example, compared to python), but it is an extremely small language with a "standard library so small it's pretty much useless".

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

#159

Earlier quoted context omitted.

Mozilla's JS Reference, I'd guess. A genuinely great resource. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Edit: And the Web API reference (which is what I was actually thinking of when I posted): https://developer.mozilla.org/en-US/docs/Web/API

Reading these things is good advice! But it's distinct from the advice given in the article, which is about reading libraries close to the heart of the language that are written in that language itself. JS is a bit odd here, possibly for good reasons (ubiquity + dynamic nature of the lang itself might mean runtime considerations override any degree of self-hosting), but it basically means it's not possible for standa…

I'll make no comment on how masterful/well written this is, but these are the most used libraries in the JS world by far margin: https://github.com/nodejs/node/tree/master/lib

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

#160

Earlier quoted context omitted.

> read the high literature The elite language in Rome was Greek.

> The elite language in Rome was Greek. gee, they didn't have go? Sure that empire was doomed.

Actually, they lacked 0, so they could not even terminate their C strings properly.
Post reply on HN