Out of the Angle Brackets
Imports ns = "http://www.w3.org/1999"
Dim book = _
<ns:Title>Learning Programming Using VB</ns:Title>
In the CTP version we decided to choose a very similar syntax to the CLR imports syntax where the main difference is that Xml namespace is a quoted string. We chose that syntax because in both cases the "Imports" declaration provides a convenient way to create fully qualified names. However the feedback we got from both internal and external users, indicated that the syntax should make the distinction between importing CLR and Xml namespaces clearer since they are used in different contexts in the program. The new syntax we chose is the Xml syntax for namespaces, the following is an example of the new syntax applied on the "Imports" statement above:
This syntax and coloring make it very clear that this is not CLR namespace, it also allow copy of namespaces declarations from Xml documents to the "Imports" section in the VB program.
Implicit reification of Xml namespaces
There are many cases where it is useful to use the global Xml namespace declaration in other parts of the program, for example when using XLinq API directly. In VB 9.0 the global Xml namespaces will be implicitly reified to a variable with the alias name.
Consider the following example of creating XName using the Imports declaration above:
Dim name As XName = ns + "Root"
Note that VB scoping rules apply to global Xml namespaces aliases in the same way they apply to global variables and to CLR namespaces aliases.
That's it, hope you like these improvements, and please let us know what you think.