At my new job I have been looking at better ways of highlighting recent interesting answers.

Here is a list of 10 answers I came across in July that I found interesting. I tried to keep this language agnostic.

So here is my top 10 list:

What do the &= and =& operators do?

Why did PHP decide to have an assign by reference construct, why?

Defeating a Poker Bot

The most upvoted non-wiki answer on Stack Overflow for July. This answer came in months after the question was asked, it is really comprehensive. I loved the ideas about shifting all the pixels and throwing glitches, brilliant.

h3. “What is the _snowman param in Rails 3 forms for?”:

Rails 3 will ship with a hack to work around oddities with … Internet Explorer and unicode. I love the creativity of the solution, and everybody loves a snowman ☃.

h3. “What is the fastest method for selecting descendant elements in jQuery?”:

For those writing javascript answers, “jsfiddle”: can make your answer so much more awesome. I love an answer that puts in the extra effort and measures performance.

h3. “Why < is slower than >=”:

I love the way Python lets you “disassemble your program”: , wonderful feature.

h3. “C#: what is the difference between i++ and ++i?”:

“Eric Lippert”: usually has the definitive answer to any intricate question you have about C#, he also happens to have to most comprehensive answers to the most trivial questions.

h3. “Haskell: How is <*> pronounced?”:

This is my favorite answer I came across, wow.

h3. “Scala - how to explicitly choose which overloaded method to use when one arg must be null?”:

I am no Scala programmer, however I found the way Scala casting syntax to a bit prettier than the C# syntax, I like that it is more concise.

h3. “Modelling a permissions system”:

At some point in time we all hit a point where we need to design a permission system, this is a good summary of our options.

h3. “Are .Net switch statements hashed or indexed?”:

You learn something new every day, the C# compiler does some funky magic when it complies a “switch” statement.


Daniel_Sobral over 11 years ago

A small note here, but to cast x to String in Scala, one would use “x.asInstanceOf[String]”. The answer used “x: String” instead, which is an altogether different thing — a type ascription.

A type cast tells the compiler to assign a type no matter what evidence the compiler has about the correct type. A type ascription tells the compiler to assign a type while taking into account the evidence about the correct type.

A practical difference is that a type ascription may return a compile time error but will never throw an exception, while a type cast may throw an exception but will never return a compile time error.

In the example, null is a valid instance of both String and List[String], so it works in those cases. However, “null: Int” would result in compile time error, while “null.asInstanceOf[Int]” would compile fine (and might even work due to boxing).

Sam Saffron over 11 years ago
Sam Saffron


Thanks for the clarification, it’s funny in C# if you had the same problem you would use a type cast eg: (string)null to ensure the right overload was called.

Thanks so much for your note!


C_Mc_Cann over 11 years ago

Well, I was wondering why I was suddenly getting a bunch of upvotes on an answer from three weeks ago. Thanks for the kind words! Being a C# coder by day, getting mentioned in the same list as Eric Lippert really makes my day, haha.

Sam Saffron over 11 years ago
Sam Saffron

It is an amazing answer! It makes me want to start coding Haskell again

comments powered by Discourse