Live data from Hacker News

To learn a new language, read its standard library

patshaughnessy.net

121–130 of 243 posts

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

#121

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 ?

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

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

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

#123

Earlier quoted context omitted.

Better really depends on who you are. Born academics can learn better by reading foundation libraries and principles, and they write articles advising others to do the same :-) What you described as better could be a really good fit for business-first coding opportunists who would get annoyed by perceived inefficiencies and petty politics in academia... The article is a terrific example of basic analysis BTW. This un…

No, even academia and pure theorists could take a fresh perspective with actual skin in the game in making software. > The article is a terrific example of basic analysis BTW. Hahaha. It's some cherry picked examples and you're already claiming it's 'a terrific example of basic analysis'. The hyperbole is real in software.

Cherry picking is 100% compatible with analysis, which is closed subjective logic, not open opportunistic logic. Plus I don't think the author is exactly trying to go head to head with your personal favorite method. Could be wrong though.

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

#124

Earlier quoted context omitted.

Does that hurt performance of the output?

Well, if it didn't, they could optimize the compiler by removing those optimizations. :)

That was(is?) the benchmark for gcc optimizations: it has to pay for itself on the compiler: if the resulting compiler code is faster but the added compilation time is even greater, it s not worth it.

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

#125

where's the french standard library I can't find it

lol, here's what the standards body has published [0]. Version 9 still in dev, with "recent" releases of:

1992 - French v9.a.e

2000 - French v9.e.m

2011 - French v9.m.q

Don't be deceived by the dates, though. The project isn't dead. The Larousse and Le Robert forks are actively developed.

[0] https://en.wikipedia.org/wiki/Acad%C3%A9mie_Fran%C3%A7aise#D...

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

#126
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 APIs people will be using to solve the vast majority of problems. Of particular interest are the APIs used for dealing text and I/O because everything involves them.

This is why Scheme is so easy to learn. The language itself can be learned in hours. The standard library is so small it's pretty much useless. Learning Racket on the other hand is much harder.

To go even further than standard library, read the language's source code. This is especially relevant for virtualized languages. The implementation reveals how they actually work and enable a much deeper understanding of it.

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

#127

Earlier quoted context omitted.

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.

I'm a big believer in 'when in Rome', not just in languages but life. If you don't like language X, don't take a job writing language X.

On the other hand, sometimes it really makes sense to strike out and define a new, higher standard for code style and paradigm in a given language, or at least to improve somewhat on the style and paradigm that's handed to you.

JavaScript used to be a messy language "not fit for professional use" (see popular JS books from the year 2000 :shudder:), but it turns out most of the problem was how people were using it.

JS code being written today looks like an entirely different language compared to early idiomatic "JavaScripts" one could use to make pages "more dynamic".

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

#128
post #89

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

Standard libraries are very concrete, not academic at all. Learning the standard library means learning how to open a network connection and making an HTTP request to some server. The language becomes useful and gives results immediately. Theory means stuff like language concurrency models, it becomes important once you start considering how to structure the code at a high level. How do I use this language to handle X requests concurrently, hopefully in parallel?

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

#129

What would the JS/TS equivalent?

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 standard definitions of standard library. So the question becomes... what are some masterful libraries written in JS?

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

#130
post #94

Maybe this works for the language that the author is talking about, but in the cases that I'm familiar with, the standard library code does not give a good idea of what "normal" application code looks like. For example it's often got a bunch of platform-specific logic or low level optimizations that, as an application author, you probably want the standard lib to abstract away from you

This is natural due to the low-level nature of a language implementation. And at some point, what's truly going on is often hidden behing a compiler intrinsic or a foreign function call to the runtime.

At the same time, there are going to be parts of the standard library that are less platform-specific and thus more readable, for example the Java Collection Framework.

Post reply on HN