(Honest first-split-second reaction.)
To learn a new language, read its standard library
231–240 of 243 posts
Re: To learn a new language, read its standard library
#232Earlier quoted context omitted.
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".
I'd recommend then read musl though and not that atrocity that is glibc
Re: To learn a new language, read its standard library
#233Earlier quoted context omitted.
Sorry mate, your argument doesn't make much sense. People can and do write OOP in C++, and just because it is multi-paradigm does not mean no one should write OOP. It's like saying, because an artist is using watercolors for this painting, they should therefore never do pencil drawings on other projects.
> People can and do write OOP in C++, if that's "textbook java oop" with runtime polymorphism then that should definitely be avoided and is pretty much considered an anti-pattern nowadays
Re: To learn a new language, read its standard library
#234Earlier quoted context omitted.
Very well put. (And if the standard library doesn't represent idiomatic use of the language, that's a red flag).
Take Scala collections. These are written using builders and if-else checks of emptiness which are definitely not idiomatic. Authors of the std-lib did them for you so you do not have to. That is not a red flag.
If emptiness is something that is so important you add extra branchpoints inside collections to check for it, there ought to be some way of disallowing emptiness or {nil,null}ness in the language itself.
Sure, it is nice for people who use the standard library, but it points to things in the language that perhaps should have been given some more thought.
Re: To learn a new language, read its standard library
#235Earlier quoted context omitted.
You seem to be implying that it is desirable to employ programmers who would get confused over bitshifting and lack the ability to figure it out.
It's the norm to work together with people with varying skill level. Weather people have the skill to figure it out also doesn't matter as they normally don't have time to figure it out. And even experienced programmers can get confused about bit hacks, sure temporary but that already a step price to pay which is seldomly worth it. It always comes with the risk of accidentally introduce a bug, even if your team only…
If flipping the Nth bit inside an integer or a byte array is an "advanced" technique, unfit for "application programmers" then I'm not sure I want to work with "application programmers".
Re: To learn a new language, read its standard library
#236To 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.
The same is true of clojure. Don’t read clojure.core as idiomatic.
([a b c d])
performant enough to matter in library code instead of using ([a b & more])
? I hope it’s the former.Re: To learn a new language, read its standard library
#237Earlier quoted context omitted.
Take Scala collections. These are written using builders and if-else checks of emptiness which are definitely not idiomatic. Authors of the std-lib did them for you so you do not have to. That is not a red flag.
The other way around: non-idiomatic use of a language in its standard library points to weaknesses in the language. If emptiness is something that is so important you add extra branchpoints inside collections to check for it, there ought to be some way of disallowing emptiness or {nil,null}ness in the language itself. Sure, it is nice for people who use the standard library, but it points to things in the language th…
Re: To learn a new language, read its standard library
#238IMHO, 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…
Could I trouble you to compare Ada and Rust, especially in terms of safety? I'd like to be able to write low-level code without dealing with the insanity of C, and my top picks are Ada (traditional answer to "safe language"), Rust (the up and coming answer to "safe language"), and Pascal (friendlier than C and way better at least for memory safety), but I'm reluctant to learn all of them to sufficient depth to be abl…
I'd recommend starting with Pascal, because of the comprehensive and high quality standard libraries (or "frameworks" -- see related recent HN discussion...) in Free Pascal and Delphi, and because Free Pascal can target a lot of different OSes. OTOH, a downside might be that you learn (to rely on) too much of the FCL/VCL in stead of just syntax, so you get confused at the lack of those libraries in Ada; that could speak for taking it the other way around.
TL;DR: IMO, in a way that's perhaps closer to two new languages to learn than three.
Re: To learn a new language, read its standard library
#239Crystal core developer here. Happy to see Crystal's stdlib as an example for how you can grasp a language by looking into stdlib code. That's what I like a lot about Crystal. Even its stdlib easily readable. Arguably, this is somewhat deteriorating as algorithms get optimized. Readability and performance being in competition. I agree with some of concerns from many commenters. For many languages, especially those tha…
Sorry, stupid question: Is this derived from the old Crystal Reports, or something completely separate?
Re: To learn a new language, read its standard library
#240Earlier quoted context omitted.
What does it mean to “hack asymptotics”?
Algorithm runtime analysis is usually measured with asymptotic estimates (Big O, Little O, Big Theta, etc). In something as commonly and generically used as the standard library of any performance focused language you're liable to find a focus on optimizing these algorithmic performance guarantees for corner cases over optimizing for simple and straightforward code.