Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm curious, how do you learn languages now?


I read a blog post with the basics, then Google everything else as I need it.


I think explains a lot of the polarised reactions people have towards Perl. It's trivial to understand the difference between the scalar var $foo and the array var $foo[0] if someone explains it to you or you read it; but if you're trying to Google-as-you-go, you don't even know what to search for. Those in the former group are more likely to find Perl delightful, while to the latter it's just frustrating.


> It's trivial to understand the difference between the scalar var $foo and the array var $foo[0] if someone explains it to you or you read it;

I don't Perl much, but aren't those both scalars and @foo is an array variable. $foo[0] would be a scalar that is the first element of @foo, right?


Yes, indeed — I should have said "scalar element of the array var..." or something.


Interesting. A good book is very efficient at teaching you how to think in that particular language, rather than translating the ideas you have in another language into the new language. How do you learn that with your method? It sounds to me that it would require a long time programming in the new language to come to the same realisations by yourself.


I've been developing software for more than ten years and it is rare now that I encounter anything genuinely new "idea wise" in a programming language.

The main questions I have when doing something in an unfamiliar language are now:

1. What is the syntax for X

2. Can it do Y

3. Is there a library/builtin for Z

For anything else, I've probably been there, done that, got the t-shirt.

I remember using some books to get a structured introduction when I started out many years ago though.

Nowadays I'll probably just open whatever existing code there is, go "ah, so it's like that", and hack away with the help of Google.

The stuff that takes actual learning tend to be major frameworks for me, not so much whatever programming language is used.


This is how to learn to mimic a new language and avoid actually learning it. It’s the difference between carrying around a French phrase book and being able to converse like a native.


Yeah, I don't think that anyone learning Raku that way would realize that the {} in the following is actually a lambda.

    for @a { .say }
So this works in basically the same way:

    my $lambda = { .say }

    @a.map( $lambda );
Or that the pointy block syntax …

    for @a -> $item { say $item }
… works on every keyword of the form `KEYWORD (CONDITION) {BLOCK}`.

    if $a.method() -> $result { say $result }
The pointy block is of course also a lambda.

    my $lambda = -> $result { say $result }
---

Raku is a much more consistent language than beginners expect. The above is just one example of this.

Because it is so consistent; once you learn something in one place, you can use that knowledge everywhere in the language.

But first you have to realize that is even a possibility.

It would take a long time to come to that conclusion if you write Raku by copy-pasting code.

That is because very few languages are as strangely consistent as Raku.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: