Via LtU, Strategies for learning new languages
When you start to learn any new language, you need to first look at the language from almost a linguistic perspective. Is it strongly typed or weakly typed? Is it statically typed or dynamically typed? Does it do garbage collection? What kind? Does it have class-based or prototype-based OO? What type of "higher order" features does it have? (Can I pass functions around as values easily?) What are its value/reference semantics?
Here's one little example of the type of hints you get from looking at a language. You look at Perl, and notice it needs to have different operators for string concatenation and numeric addition. It shows you it's has weak dynamic typing. On the other hand, you look at Ruby, and you have to explicitly convert a numeric string into a number if you want to use it as such. It has a little different mindset, even though things might look similar on the face of it. Do variables auto-vivify? Perl, yes, Python, no. Etc. etc.
So, when you know enough languages, you start to look for little things that key you off to how they work. When I started with Python, I was confused by its scoping, and then I noticed they had a "global" keyword, and I was able to immediately understand that its scoping model was similar to PHP. They've since added lexical scoping.
I've always thought C's approach to reference/value semantics is interesting to look at. Everything is passed by value, but then, some values can be pointers. Also, C doesn't have closures, but then again, all functions are statically declared in the global scope.
The problem arises when a language uses features you're not used to. While I think I understand what's going on, I'm not totally comfortable yet with Python's generators. I've only recently got my brain wrapped around multi-methods, or multiple dispatch, and with either of these features I'd really have to write some code that uses them before I could claim I really understand what is going on. I might understand conceptually how Lisp's macros work, but I've never used them. Right now I'd probably be a terrible Lisp programmer. Don't even ask me about continuations - I wish I grokked them.
One of the messages in the thread had this:
Until you've actually written at least several hundred lines of code in a language you effectively know nothing about it.
That's very true. And moreover, if you don't use a language for awhile, things don't stick. It'd take me a little while to get back up to speed with Python, and even Perl again, since I haven't used them in awhile. Our brain seems to treat programming languages very similarly to how it treats natural languages. You have to use a language for a long time to really become fluent, learn the culture, learn the idioms, for computer languages, to learn the class library, etc. etc.
Feel free to post a comment below. Please see my comment policy.
Formatting Rules (No HTML):