Live data from Hacker News

Nerdsniping: A glimpse into a stubborn mind

blog.andyet.com

11–20 of 94 posts

Re: Nerdsniping: A glimpse into a stubborn mind

#11
post #7
post #5

The differences between programming syntax and elementary/Boolean algebra are very awkward to understand clearly and deal with correctly. We clearly understand mathematical algebra to work one way, and we naturally assume programming algebra works the same way, which it doesn't at all. Here, the antagonist says that b can't be 1 and 2 at the same time, which would be self-evident in mathematical algebra, but turns ou…

>This difference in how syntax is understood actually presents a barrier to programming for modestly trained mathematicians, who would otherwise be expected to excel. Although this is true in general that syntax can be a barrier to entry, the article provides a particularly poor example. If anything, the article demonstrates how mathematical training is good preparation for many pitfalls of programming. Mathematician…

> I can't imagine any mathematician taking more than a few minutes and a google search -- let alone 11 days -- to figure out this loophole.

If anything, mathematicians are incredibly used to overloaded equals operators.

Re: Nerdsniping: A glimpse into a stubborn mind

#12
post #11
post #7

Earlier quoted context omitted.

>This difference in how syntax is understood actually presents a barrier to programming for modestly trained mathematicians, who would otherwise be expected to excel. Although this is true in general that syntax can be a barrier to entry, the article provides a particularly poor example. If anything, the article demonstrates how mathematical training is good preparation for many pitfalls of programming. Mathematician…

> I can't imagine any mathematician taking more than a few minutes and a google search -- let alone 11 days -- to figure out this loophole. If anything, mathematicians are incredibly used to overloaded equals operators.

> If anything, mathematicians are incredibly used to overloaded equals operators.

That's my point. The == sign meaning many things is unsurprising (and key to this "hack"), whereas explicitly using two different symbols for equivalence in the same expression is a huge, glaring signpost to pay attention.

Re: Nerdsniping: A glimpse into a stubborn mind

#16

"I want my code to execute if port is 80 or 443, and http is false" Couldn't you simply do this?: if ((a==='80'||b==='443') && http===false) { ... }

I think the goal was if (a==='80' || (b==='443'&&http===false)) {...}

I think you're right, but it's funny that both the code and the written explanation do not make that clear. Missing parenthesis in one case and missing comma in the other.

I feel like I tend to use parenthesis when they are not required, but I err on the side of caution and I think it makes things more readable.

Re: Nerdsniping: A glimpse into a stubborn mind

#17
post #12
post #11

Earlier quoted context omitted.

> I can't imagine any mathematician taking more than a few minutes and a google search -- let alone 11 days -- to figure out this loophole. If anything, mathematicians are incredibly used to overloaded equals operators.

> If anything, mathematicians are incredibly used to overloaded equals operators. That's my point. The == sign meaning many things is unsurprising (and key to this "hack"), whereas explicitly using two different symbols for equivalence in the same expression is a huge, glaring signpost to pay attention.

As demonstrated in the postscript, it can still be accomplished when the symbols are all the same. So that difference is not the key to the hack. As ronaldx noted, the key is that a variable can change value in between two equivalence evaluations within a single statement.

Re: Nerdsniping: A glimpse into a stubborn mind

#18
post #13
post #4

> Have I learned anything directly useful? You probably haven't. But a less experienced programmer has learned why you should always use ===.

The example at the end of the article shows how you can have the same problem while always using ===.

The example at the end of the article shows how you deserve all sorts of bad things happening to you if you mutate values in a freaking getter.

Re: Nerdsniping: A glimpse into a stubborn mind

#19
post #13
post #4

> Have I learned anything directly useful? You probably haven't. But a less experienced programmer has learned why you should always use ===.

The example at the end of the article shows how you can have the same problem while always using ===.

I think it's a great example of why overriding the default prototype functions is a bad idea.

Re: Nerdsniping: A glimpse into a stubborn mind

#20

I was working with this guy - he always tried to prove that everything is possible wasting time. He ALWAYS over-complicated simple things. He was horrible to work with and everyone hated him. Not to say you are just like him etc. but this post reminded me of him because it was probably exactly what he would do.

Wasting other people's time is a negative, but deepening your understanding of a topic by examining edge cases is generally worthwhile, IMHO.
Post reply on HN