## Whiteboard with Anders Hejlsberg

Link: MSDN TV: Whiteboard with Anders Hejlsberg

(The cameras seem to be following Anders around these days).

Anders answers questions from Tech-Ed audience about C# design decisions and possible future directions of the language. A number of subjects are discussed, including AOP, multiple inheritance, closures, guaranteed dispose, etc...

I'm about 30 minutes into the hour and a half video. Quite interesting from a PL perspective. I'll enter my notes into the comments section as time permits.

## Comment viewing options

### Not available

The link doesn't work for me.

### Bummer

MS must have taken it offline in the interim. I downloaded it locally, so I'll try to get my notes in order. Hopefully they'll bring it back at some point.

### Bittorrent?

The link is still not available, maybe you can start a bittorrent? ;-)

### Notes

Just starting on the notes, but I thought I'd break them into pieces as it may take a bit to get them all together.

• AOP: Skeptical about AOP, taking a wait and see approach. Considers it interesting for the prototypical examples of logging, debugging, monitoring, and instrumentation. But is worried about it as a general programming discipline because it makes the code hard to reason about. You can't understand the code without an Aspect IDE. Likes to use any editor for code. Not actively working on AOP for C#. Also says that you can do a lot of the stuff with hosting environments to get transaction guarantees and sessions. Places emphasis on web service environments.
• Dynamic Languages: The differences is in whether variables are typed or not. Thinking about type inferencing in next version. Explains that there are two reasons people like dynamic languages. First, they don't have to declare the type of the variables up front, giving a sort of brevity to the code. Second, the code has a lot of repetitiveness in type information. For example, the declare and assign statement of:
   Point p = new Point();


repeats the information of class type Point. Looking at the following type of construct in next version:

   var p = new Point();


where the type of variable p can be inferred from the assignment. Along different lines, also thinking about combining object construction and initialization through and Object Initializers. So instead of writing:

   Point p = new Point();
p.x = 5;
p.y = 10;


you could combine the initializers with the object instantiation:

   Point p = new Point{ x=5, y=10 };

• Multiple Inheritance: The cop out answer is that if they were going to have multiple inheritance that they needed to have it in version 1.0 of the CLR. It's too hard to add on later. Multiple inheritance would need to be supported in the APIs, which means that it would have to be usable from VB (not gonna happen). Though they are not looking at MI, they are looking at default method implementations on interfaces. The interfaces would still not be allowed to have state. Different from MixIns because the MixIns allow state. Expresses some interest in mixins giving the following example that can't be done today:
   class Printable<T>: T {
}
class MyForm: Printable<Form> {
}

• isNumeric on String: Question was asked why the string method doesn't have an isNumeric() function. String class is not appropriate place for such function as it would open up to all sorts of other is functions (isDate, isBool). Says that they added a static method to all int32 classes that serves the same purpose:
   public static bool TryParse(string s, out int x);

• in parameter: Question was why C# didn't have const parameters for methods like C++. Says only reason it works in c++ is you can cast it away when it's inconvenient. Problem is that it would require an attribute on every object about whether it is read/write or a constant, introducing an extra layer of complexity. Also says that every language written for the CLR would have to respect the const declaration or it would be useless. Finally, ends up explaining the difference between in, out, and ref (in/out) parameters and how they are implemented by the compiler.
• intellisense: Question is whether intellisense is bad for programmers (making them lazy). Anders jokes whether the questioner wants to make C# as hard as Java? Gives the analogy of calculators being used for college exams (are we teaching them to add, or are we trying to get them to think at higher levels). Doesn't think memorization is a good thing - better to think about the algorithm itself.
• default parameters in C#: Question is why C# doesn't have default parameters. Hedges by saying that what they thought was important at the time may be less so. Considers it somewhat duplicative with constructor overloading. Original concern was that the default values ended up getting burned into the call site (i.e. the compiler would stick the default values at the point of call). The question turned to whether it was possible to share xml documentation for overloaded methods (says it's not a bad idea).
• edit & continue in C#: Says don't be surprised - that it could happen in the future as the building blocks are there.

### Re: Intellisense

Anders jokes whether the questioner wants to make C# as hard as Java?

Makes you wonder when a language designer conflates editor and language issues (even if it's a joke)...

Chris, if it only takes a sec to fingerprint the .exe file, would you be kind enough to do so? (Please don't waste time otherwise.)

### Thanks for the hint!

Hey,

The one I got is:

\$ md5sum 20040624CSHARPAH.exe
b8873b5591ca68189a1649813140b583 20040624CSHARPAH.exe

I'm guessing this is what you mean by fingerprinting it.

### It's not in cache anymore...

But if you search for "20040624CSHARPAH.exe" you'll get it. Aanyway, the full download url is:

### Zip archive

Is this a self-extracting zip archive of a media file? In other words, can I use unzip and Windows Media Player to watch it on my Mac?

### It is a self-extracting zip file

The format of the media file is .wmv, so I assume that any media player that can handle that will do.

### Anywhere to get hold of the media file?

I just downloaded the .exe on my Mac, but I can't unzip it, so clearly the "self-extracting" executable stuff is getting in the way. Anyone know how to remove the executable (which I assume is a prefix)? Or, does anyone know where the raw media file is available to download? Failing that, I could boot my XP partition at university, but it's a hassle as I have to take it off the network (hasn't been patched in months).

### Nice show

Thanks. It was a nice show. (And it's kind of a dream job, isn't it?)

Some quick notes.

1. Mixins - the solution, based on generics+inheritance, is quite similar to the Ada approach. You can do what he describes on the board with Ada95, today...

2. in/out/ref is quite similar to the Ada approach. However, in Ada you have in/out/in out/access [similar to ref]. The compiler decides how to implement out/in out, whether by passing references or by copy-restore.

3. "We can add value by codifying patterns" - this is a recurrin theme here (recall "mining patterns for langage feaures"), and a nice summing up of their design philosophy.

4. The discussion on database integartion is revealing. This obviously something we are going to hear more about. I am sure Erik can tell us more, but since he hasn't I suggest checking his papers to see were they are heading... It would have been nice to ask him about DSL integration, and plug SchemeQL. Shame no one did..

### Codifying patterns

I agree that codifying patterns is a nice design philosophy, but it can come at the cost of language complexity if the method of codifying patterns is just a bunch of added special forms. What is nicer is if the method of codifying patterns arises from normal language features (thinking of lisp macros here) instead of introducing new keywords and constructs. It's also nice if you can codify patterns without have to rely on the whims of the language designers.

P.S.: I'll try to finish the notes in the next few days. The notes above cover only the first third of the video.

### re Codifying patterns

Actually I think it's a problematic design philosophy, for exactly the reason you give. What interested me was that Anders alluded to them thinking about ways to enable programmers to codify patterns. Now this sounds much more exciting.