Atomicity, volatility and immutability are different, part one

I get a fair number of questions about atomicity, volatility, thread safety, immutability and the like; the questions illustrate a lot of confusion on these topics. Let’s take a step back and examine each of these ideas to see what the differences are between them. First off, what do we mean by “atomic”? From the…

23

Read-only and threadsafe are different

Here’s a common problem that we face in the compiler realm all the time: you want to make an efficient immutable lookup table for mapping names to “symbols”. This is in a sense the primary problem that the compiler has to solve; someone says “x = y + z;” and we have to figure out…

15

Optional argument corner cases, part four

(This is the fourth and final part of a series on the corner cases of optional arguments in C# 4; part three is here.) Last time we discussed how some people think that an optional argument generates a bunch of overloads that call each other. People also sometimes incorrectly think that void M(string format, bool…

18

Optional argument corner cases, part three

(This is part three of a series on the corner cases of optional arguments in C# 4; part two is here. Part four is here.) A lot of people seem to think that this: void M(string x, bool y = false) { … whatever … } is actually a syntactic sugar for the way you…

6

Optional argument corner cases, part two

(This is part two of a series on the corner cases of optional arguments in C# 4. Part one is here. Part three is here. This portion of the series was inspired by this StackOverflow question.) Last time we saw that the declared optional arguments of an interface method need not be optional arguments of…

11

Optional argument corner cases, part one

(This is part one of a series on the corner cases of optional arguments in C# 4. Part two is here.) In C# 4.0 we added “optional arguments”; that is, you can state in the declaration of a method’s parameter that if certain arguments are omitted, then constants can be substituted for them: void M(int…

10

Maybe there’s something wrong with the universe, but probably not

No kidding, I was just walking down a hallway in my building when I overhead the following quite loud conversational fragment through an open doorway: Angry woman’s voice: “Why are you in the ladies room?! You are the third man to… oh no.” Like Hobbes, it’s the moment of dawning comprehension that I live for…

31

Uses and misuses of implicit typing

One of the most controversial features we’ve ever added was implicitly typed local variables, aka “var”. Even now, years later, I still see articles debating the pros and cons of the feature. I’m often asked what my opinion is, so here you go. Let’s first establish what the purpose of code is in the first…

54

Refreshing the Async CTP

Good morning everyone! I am pleased to tell you that the C# and VB teams are announcing a “refresh” of the async Community Technology Preview at MIX11 today, and that it is as of right now available on the Async CTP site. Recall that the CTP release is an early look at our thinking for the proposed async…

17

Happy birthday Channel 9!

Good heavens I can’t believe it’s been two years since I wished Channel 9 a happy fifth birthday. Obviously it’s been a busy month for me doing interviews. If you’re not sick of hearing me rattling on about compilers, Roslyn, and so on, check out my latest C9 interview with Charles and Erik Meijer.

2