4 ms·
> C pointers being typed is absolutely central. No it isn't. The rest of your post shows why. > Firstly, because a pointer is typed, when we dereference it N
by torstenvl 8y ago
> C pointers being typed is absolutely central.
No it isn't. The rest of your post shows why.
> Firstly, because a pointer is typed, when we dereference it
Nonsensical and circular.
> Secondly, arithmetic on pointers...
Nonsensical and circular.
> Thirdly, we get error checking: there is a good amount of resistance in the language against mixing up types. If we convert one type of pointer...
Circular.
Every single one of your points about why this is an important property of pointers presupposes that the reader knows what a pointer is and how it works. It's a fundamental truism that you can't introduce, explain, and define a term using the term itself.
The OP's introduction does not suffer from this problem, which is why it is superior to your proposal.
(Edit: You all can downvote me all you want, but you're still objectively wrong.)
- kazinator 8y ago> Every single one of your points ... presupposes that the reader knows what a pointer is and how it works. Pardon my mistake; I made these points under the belief that I'm in a debate about how to teach pointers to a beginner audience, not that I'm addressing that audience itself.
- torstenvl 8y agoDistinction without a difference. If you can't explain to your students why the words out of your mouth are useful, you've already lost them. The fact of the matter is that you're getting hung up on implementation details that do nothing to explain the concept. Pointer arithmetic, how pointers interact with the type system... those are important, but they're completely incidental. There's no fundamental reason C had to implement pointers that way. They're factoids about how pointers work in C, practical mechanics. They tell you nothing about what pointers are in essence: a memory address. And I don't know if you've worked with novice programmers lately, but it seems pretty obvious to me - based on how so many people get their heads discombobulated about pointers - that that conceptual clarity is needed. The details you're listing don't need to be in the first sentence.
- kazinator 8y agoThat C pointers have a type which is used for checking, semantics of memory access and arithmetic falls into a category that I like to call requirements, whereas I use the word implementation detail for something like how many bits are in a pointer, and do pointers to bytes have the same representation as pointers to wider types. (These are also requirements, but ones an implementation can vary.) I accept your terminology, though. Let the key features of C be called "implementation details". Then, if the goal is to teach C, it is "implementation details" we must teach. (In any case, the students are probably eager to learn implementation details in the regular sense also, otherwise they would have been satisfied with their Python or Javascript class.) If what you really mean is that we should teach C by instead teaching the architecture of a machine, whereby C is treated as just a notation for manipulating that machine, and concepts like the type system are considered annoying/distracting details in that notation, then I strongly disagree. Even if it is easier to teach that way, and the students eagerly absorb and regurgitate the simplified misconceptions, they are ill served.
- deleted 8y ago[deleted]
- dang 8y agoPlease stop now.
- deleted 8y ago[deleted]
- dang 8y agoCome on, please don't be a jerk on HN.
- kazinator 8y agoI think this was misunderstood due to not being phrased right; I do not believe, let alone wish to insinuate, that torstenvl is a newbie who doesn't understand pointers. I mean, that doesn't even make sense. Though flagged, it was also upvoted to +2 at one point.
- dang 8y agoI'm sorry if I misread you. The comment sounded like a putdown to me, but it's easy to misread intent, especially when reading quickly, as moderation entails. If I read it the opposite way, I think I can see what you mean—but then it's a subtle enough point that the nuance was likely lost on more readers than just me.
- dang 8y agoPlease don't post in the flamewar style to HN. It leads to increasing nastiness, as happened below, and you did quite a bit to fuel that. If you'd please review https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html and take the spirit of this site to heart, we'd be grateful. We don't want threads to go up in flames.
- torstenvl 8y agoI'm sorry, but I disagree. The very first sentence of the linked article is being criticized unfairly. People are claiming that the very first sentence is incomplete because it should explain pointer arithmetic and typing. Explaining what a pointer is by using the term "pointer" and explaining how to use one is a circular definition. A student who has never heard the term "pointer" before is going to be completely lost if the instructor jumps straight to "Pointer arithmetic works by increments of the size of the type of object to which the pointer points." If that is the first statement someone is exposed to, it will not make sense to them. I understand that someone may not like their proposal being called circular, but I don't think it's unfair or bad behavior to point it out. The linked-to article is well done. There are some minor errors, as have been pointed out elsewhere. However, I think the criticism in this thread of conversation is deeply negative in a hostile, nasty way.
- Stratoscope 8y agoDan's request wasn't about the technical merit of your comments, it was about the style: > Nonsensical and circular. > Nonsensical and circular. > Circular. > You all can downvote me all you want, but you're still objectively wrong. If you feel that something is being criticized unfairly, you will win more people over to your point of view with civil and respectful conversation instead of flamebait. We can have different opinions about something and still have an enjoyable conversation and learn from each other, as long as we interpret each other charitably and have a sense of humor about it. Fair enough?
- torstenvl 8y agoI am all on board with being civil and respectful. It's the matter of application where I seem not to be of the same mind as some others. I don't want to belabor the point, but I don't agree with the way this played out. If you'd like to discuss further, my email is my username at GMail dot com. Otherwise, I'm going to let this lie.