Live data from Hacker News

To learn a new language, read its standard library

patshaughnessy.net

201–210 of 243 posts

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

#201
post #178

Earlier quoted context omitted.

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…

JavaScript today wouldn't be recognizable to a JavaScript developer 6 years ago, especially when using class syntax, destructing, and async/await, among many other syntax additions.

Javascript the language has actually changed in those six years.

Common Lisp, OTOH, has not... But styles of CL do change as do libraries, making your statement as applied to CL much more plausible.

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

#202
post #200

Earlier quoted context omitted.

https://arne-mertz.de/2015/07/c-is-not-an-object-oriented-la...

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

#203

For C++ many standard library functions can't be implemented in standard C++. And it not only shows some very obvious compiler built-ins in the library, but the library can depend on behavior guaranteed by the compiler which is otherwise undefined by the standard. Therefore it's not always wise to learn techniques from the standard library, as it can depend on implementation defined behavior, and this dependence can…

C++ blurs the line b/w language and standard library in some cases. Example initializer list.

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

#204

Earlier quoted context omitted.

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…

JavaScript was never a messy language, it was the different browsers that created a horrible situation for using JavaScript in web pages.

Actually it was very messy. People were encouraged to use it as a write-only imperative scripting language.

People thought VBScript was more powerful. JavaScript was like that attention-seeking red-headed stepchild that you see at family reunions.

There's a good reason Douglas Crockford re-introduced JavaScript as "the wwwrld's most misunderstood programming language." He saw beauty within that others didn't.

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

#205
post #171

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…

> To go even further than standard library, read the language's source code. This is especially relevant for virtualized languages. Yes, reading hundreds of thousands LoCs written in C/C++ is totally viable method of learning languages. ;)

Yes. I learned so much after I started reading source code. I discovered the history and implementation of many language features, including the more obscure ones which are the subject of many fun stackoverflow questions. I obtained a deeper understanding of the threading model. I developed a good sense for the performance cost of my code as well as the optimizations I can expect from the implementation. I was able to create libraries in C that can be loaded at runtime by the language. I was able to embed the language in C projects.

This isn't something beginners should do, of course. It is a fact that it does lead to a much deeper understanding of things.

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

#206

Earlier quoted context omitted.

JavaScript was never a messy language, it was the different browsers that created a horrible situation for using JavaScript in web pages.

Actually it was very messy. People were encouraged to use it as a write-only imperative scripting language. People thought VBScript was more powerful. JavaScript was like that attention-seeking red-headed stepchild that you see at family reunions. There's a good reason Douglas Crockford re-introduced JavaScript as "the wwwrld's most misunderstood programming language." He saw beauty within that others didn't.

That's something I don't really understand. The language is a garbage-collected C-like. If you don't abuse objects/this/.call, plain Javascript is very readable. What made it a "write-only imperative scripting language"?

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

#207
post #71

Earlier quoted context omitted.

Go doesn’t have the libraries of python however. In certain computing domains you would first have to spend 10 years rewriting the python frameworks in golang before you could even be on parity with python. I am most familiar with scientific computing and GIS applications — python is miles ahead of golang in ecosystem support in those domains.

If that was a useful argument for the future we'd all still be using Perl. I mean, I still write a lot of Perl, but everyone else would be too.

And if this wasn't a useful argument many more people would use OCaml, Crystal, D, etc ; and every new language wouldn't be met with "I like it but it doesn't have the libraries I need so I'll keep writing Java".

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

#208
post #195

Earlier quoted context omitted.

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…

Memory "unsafety" isn't bad . It's just a feature. In fact it's a feature some people want and need. I'd still start with C. There are all the ressources in the world to learn and it's better to know how to manage boundaries and memory allocation by hand than the other way around.

Most of the time memory unsafety isn't a feature people want or need.

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

#209

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.

Agreed. We're 100% Go in our back end, and in the process of hiring. We literally wrote in the job posting, "If you don't want to write Go, this job is not for you."

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

#210
post #119

Earlier quoted context omitted.

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.

Yes, in C++, a pair of member variables is a complex conponent. That is my point.
Post reply on HN