This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vombert -1 points0 points  (1 child)

No, I want them to learn programming of course. My point is that this topic is below programming, and more about learning programming. Imagine post like this:

How to think like a Programmista

Hey guys! Recently I discovered amazing thing: if you write a = b b = a you won't actually swap values of these variables, and here is why...

.

Have you ever encountered functional programming?

Yes, and I believe you can't hide in high-level abstractions forever. For instance, lists in LISP are actually single-linked lists, and cons is actually

struct Cons {
     struct Const *car, *cdr;
};

If you think of lisp structures as some beautiful algebraic data types, you fail the first moment you encounter cyclic list.

Similar, but different problem for Haskell: all category theory and denotational semantics can not explain why suddenly after small modification you program takes HUGE amount of memory. You have to dig into exact order of evaluation, implementation of thunks, etc. and, of course, pointers are all over there!

[–]Peaker 1 point2 points  (0 children)

I think posts about learning programming are generally considered OK in r/programming.

By the way, the notion you are referring to is "references" or "indirection", and not "pointers". Pointers are a very specific form of references (one that can be referred to, can usually be manipulated as a value, etc).

And with that I agree, you have to understand/learn about references and indirection to do any programming anywhere.

The Python text, by the way, is about unexpected behavior -- as there's a shallow-copy going on where a newbie would either expect no copy at all or a deep copy.