a[5] == 5[a]
stackoverflow.com
stackoverflow.com
So this is what HN has degenerated to? I'm sorry, but I remember eagerly reading the front page, learning things from interesting articles, and -- more importantly -- reading well-written commentary from people far more accomplished than I. I lurked, because I couldn't contribute at the level that most of the regular commentors could, but I learned a great deal.
HN has retained its preoccupation with not being reddit (which is noble), but has not retained the quality to justify it.
Great communities are transient, and HN is probably what taught me that. I have nothing but respect for pg, and for the community that once populated HN.
Peace. I'm out.
Crazy rant done.
Might be a sign that it's time for you to start posting some well-writen commentary yourself ;)
He's not the only one saying these things. It's just how it is. After awhile, what was is no more. HN stood longer than most.
I think anyone who says that people don't have a right to miss that and assumes that there is no problem is part of the problem.
I'm this is true to some extent, but (as much as I'd love to wholeheartedly agree with you), the reason I don't consider this likely is this: the main reason I have this opinion of HN is because of one 3-month period in 2009, where I was off the grid (bought a car in Europe, drove around, drank lots of booze, smoked some mushrooms, &c). I assure you I didn't learn about computers during that time. When I left in June, I thought HN was full of insightful articles and comments; when I returned in September, I thought it was markedly worse. I think HN had its Eternal September then, and it's been steadily downhill since then.
(Um, yes, I was keeping track of replies, and logged back in to post this. Mea culpa.)
I wrote my post from the perspective of being a long time lurker on various tech forums who is only just beginning to feel I may be able to contribute on some topics (and only after many years of coding, reading & sponge-learning from sites like this one).
If it weren't for stories like this & people like yourself engaged in insightful discussion about them I personally would have missed a lot of "assumed knowledge" in the developer world, heck I wouldn't have heard of K&R (the shame!).
So I guess what I'm saying is: please don't leave, stay & help make us noobs less ignorant!
[edit] context
I think I started lurking HN back in 2007 (which I also believe is the first year of HN). I remember feeling a euphoric sense of being overwhelmed with great content from knowledgeable people and articles. I learned a lot about start ups. I learned a lot about programming. I learned a lot about partaking and consuming thoughtful commentary in a semi-anonymous setting.
But you know what? All of that content is still here, in different formats. The audience is bigger and so there tends to be more mainstream stuff on HN now, particularly around politics. But I think the biggest change is in myself. I've read the same stuff about lean startups at least 100 times now rehashed in different ways. Even though I've never raised money from a VC before, every time I read something on HN about it, I feel like I've been through the process dozens of times. Every 37signals blog post that gets submitted seems like a rehash of the last one. So most of the submitted content around those topics seem like old-hat.
At some point, when you continue to consume the content from the same sources for years on end, you're going to see more repeat episodes and you'll have fewer stimulating moments. That's just the nature of it - and I think it's just as important to recognize that we're transient individuals. Your probably a different person now with a higher capacity and understanding and that's probably in part thanks to HN.
I could just as easily claim that HN has 'degenerated' if someone posts a Stack Overflow post about what the /o flag does on Perl regexes. Or maybe there will be a Stack Overflow post about how substr('abc', 1, 1) == substr('abc', 0, 1) in Oracle because it helpfully translates the 0 index to a 1 index. I mean, it's right here in the Oracle docs[1]:
When position is 0 (zero), then it is treated as 1.
It's Oracle 101![1] http://download.oracle.com/docs/cd/B28359_01/olap.111/b28126...
Section 6.5.2.1 "Array Subscripting" states in item (2) under "Semantics" on page 70:
A postfix expression followed by an expression in square brackets []
is a subscripted designation of an element of an array object. The
definition of the subscript operator [] is that E1[E2] is identical
to (*((E1)+(E2))). Because of the conversion rules that apply to
the binary + operator, if E1 is an array object (equivalently, a
pointer to the initial element of an array object) and E2 is an
integer, E1[E2] designates the E2-th element of E1 (counting from
zero).
In other words: a[5] is equal to (*((a)+(5)))
5[a] is equal to (*((5)+(a)))
So what are the rules for E1+E2? Refer to section 6.5.6 "Additive Operators", item (8) under "Semantics" on page 83: When an expression that has integer type is added to or subtracted
from a pointer, the result has the type of the pointer operand. If
the pointer operand points to an element of an array object, and
the array is large enough, the result points to an element offset
from the original element such that the difference of the subscripts
of the resulting and original array elements equals the integer
expression. In other words, if the expression P points to the i-th
element of an array object, the expressions (P)+N (equivalently,
N+(P)) and (P)-N (where N has the value n) point to, respectively,
the i+n-th and i−n-th elements of the array object, provided they
exist.
In other words, if (P)+N is equal to N+(P), you need only substitute "a" for "P" and "5" for "N" and that proves a[5] == 5[a]. If I've missed something, corrections are welcomed. &12[5] == 17
(ignoring OS memory protection)?Than again, I guess the days where you could assume everyone who knew how to program programmed in C are long gone.
TAOCP Vol 1 Amazon rank: 364,370. K&R C Amazon rank: 2307
Based on the above, and also that C programmers are a subset of everyone that knows how to program, it seems that the two ratios would be off by a few orders of magnitude. So I don't think this comparison is really correct.
I'll add to this my anecdotal experience that about half of the people I have worked with who call themselves C programmers have read K&R.
Poor HN.
But it's quite surprising for just about everyone else, I think. Does any other language allow this? I think JavaScript allows some syntactic contortions, but I don't remember offhand if it permits this particular one.
a[5]
evaluates to something like: *(a + (sizeof(a) * 5))
so shouldn't 5[a]
evaluate to *(5 + (sizeof(5) * a))
Those don't seem equivalent, unless I'm missing something.It only wouldn't work in very weakly typed languages like ... assembler?
Separately:
e + p where e : integer-type and p : pointer-type
p + e where e : integer-type and p : pointer-type
are evaluated roughly as: (pointer-type)(e*sizeof(*p) + (size_t)p)
(pointer-type)((size_t)p + e*sizeof(*p))
but these are very rough translations, because we're wandering into implementation-defined territory (substitute uintptr_t for size_t as desired etc).The type analysis on the addition is reminiscent of e.g. promoting integers to floats:
i + f where i : integer-type and f : float-type
f + i where i : integer-type and f : float-type
correspondingly: (float-type)i float-type::+ f
f float-type::+ (float-type)i
The '+' built-in is overloaded in C. *((pointer-type)(e*sizeof(*p) + (size_t)p))
*((pointer-type)((size_t)p + e*sizeof(*p))) a[x][y] = y[x[a]]
a[x][y][z] = z[y[x[a]]]
and so on.http://stackoverflow.com/questions/1995113/strangest-languag...
it will stay forever in my bookmarks.
Anyway, Array subscripting (brackets) is not an operator in C. It is just syntactic sugar. This is different from C++ (but even in C++, C compatibility is maintained for primitives) .