Friday, 31 October 2008

PDC Day 4: XAML, .Net 4.0, MGrammer, and F#

Has anybody got a handkerchief? sniff, snuffle, wipes away tears. PDC is over. They’ve turned off the wireless. We’ve been kicked out of the conference centre. All my new geek friends are heading home. Will I ever find people that understand me so well ever again? Never mind. It was good well it lasted, and I’ve collected a good bunch of business cards. Perhaps geek friendships work best by email and twitter anyway.

And get this: I’ve got Raymond Chen’s autograph. On his own business card. He even promised to stop by my blog. Better make sure it looks tidy; quick check for inanities: geek royalty might be here any minute. Raymond, if you’re reading this: I’ll stop gushing now! Promise!


No keynote today, but that meant more time for a whole load of interesting sessions. The first one I attended was on XAML. That’s right: a whole session on eXtensible Application Markup Language. They announced a new version of it, with a raft of new language features, and new XAML Readers and Writers.

The new language features include:

  • The ability to reference other elements by name – independently of anything that the target framework (like WPF) provides
  • Full support for Generic types, everywhere in the language – this is done by using {x:TypeArguments} when defining instances for example
  • Better support for events – including a markup extension that can return a delegate
  • The ability to define new properties of a class within XAML
  • Use of Factory methods to create instances

They’re also introducing a new library, System.Xaml.dll is its name, I believe. In this library will be classes for working with XAML in a much more fine-grained way than the current XamlReader and XamlWriter give us, and with much better performance. Basically they work with a new intermediate format of XamlNodes: kind of like an Object Model for XAML. For example, XmlXamlReader will take an xml file, and return some XamlNodes representing the xaml at a higher level of abstraction than xml. Then an ObjectWriter is used to take those XamlNodes and turn them bit by bit into objects. The cool thing is that you can do the reverse: there’s an ObjectReader that will take an object and return the XamlNodes that represent it, and a XmlXamlWriter  that push those XamlNodes to xml. They’re also making public the BamlReader and BamlWriter classes.

As a demo of all the new stuff, they showed a demo of a whole client-server app written entirely in XAML: WPF UI, Windows Workflow handling the button clicks calling to a WCF service defined in XAML with a Windows Workflow again doing the work. Impressive!

.Net 4.0

After that I went to a session on CLR Futures: basically the foundations of .Net 4.0. The nice feature here, as I already mentioned is the ability to load .Net 4.0 into the same process as .Net 2.0. Now I actually can’t see myself using this feature directly, but I’m sure it will open up a lot of opportunities in other areas, mainly around application addin models; no longer it will it cause a problem if an application loads an addin bound to one version of the .net Framework, and then a second addin needing a newer version; both can happily co-exist.

There are going to be a number of refinements throughout the CLR:

  • Improvements Garbage Collector to reduce the number of times it has to pause the application to do garbage collection
  • Improved Thread Pool to support the new Parallel Extensions framework
  • A new feature that will prevent certain critical exceptions being caught – the ones that indicate a corrupt application that should bomb out as quickly as possible: things like AccessViolation and others.
  • New Profiling APIs that will allow Profilers to attach to running applications – a featured focused on Server scenarios.
  • Managed Crash dumps can be opened in Visual Studio

Two announcements that I found most interesting: they’re going to add tuples to the BCL – we have the F# and Dynamic languages teams to thank for this, and also for the BigInteger class that they’ve finally got right, with the optimisation expertise of the Microsoft Solver Foundation team.

The second one: a new Contract class, and associated features. This is like Assert on steroids. It allows code contracts to be specified within methods. For example, there are the Contract.Requires methods that set up pre-conditions, and the Contract.Ensures method that set up post-conditions. All these conditions are established at the beginning of the method, then as a post-processing step, somebody (not quite clear whether it’s the compiler or the JIT) rearranges the post-conditions to make sure they’re checked at the end of the method. There are also going to be tools that will check a code-base for situations where these conditions might be broken – I’m guessing that Pex is the place to look for this.


After a hastily consumed lunch-in-a-box, I headed for Chris Andersons talk on the new MGrammar language and tooling for building Domain Specific Languages. This was exactly what I was hoping for, and Chris did a brilliant job of showing it off. The topic deserves a blog post of its own, but suffice it to say for now that the Intellipad text editor provides a great environment for developing and testing the DSL, and even provides syntax highlighting for your new language once you’ve defined it. There are also APIs that can be used in your own applications that accept a grammar and a string and will parse it, and provide back a data representation of it. Exciting stuff.


The last presentation of the conference was Luca Bolognase’s Introduction to F#. Luca did a great job of showing the strong points of F#: the succinctness of the syntax and its integration with other .Net languages. The last point he showed really wowed the audience: he had written a real world application that pulled stock prices off the Yahoo finance website and did some calculations with them. The punch-line was when he add one “async” keyword and sprinkled a few “!” symbols, and the whole function became parallelized.

The remains of the day

And that was the end of the conference. But the day held one last surprise for me. On the bus back, I found myself sat next to two guys from the Walt Disney World Company. We got talking about the conference (I doubt anybody on the bus was discussing much else), and when we got back to the hotel they mentioned how they were going to meet up with some colleagues at Downtown Disney, and they invited me to go along with them. We had a great dinner down there, munching over M and F# as well as pizza. So Dave and Kevin: thanks a bunch. It was awesome!

PDC is at an end. Tomorrow I fly home. Then the real fun begins: making sense of everything I’ve heard, and putting it to work.


Anonymous said...

Thanks for visiting the booth. It was nice meeting you!

Unknown said...

Thanks for stopping by. I hope you found something of interest?


Post a Comment