Triple dot syntax for descendants axis in VB 9.0

Many people asked us why did we choose the triple dot syntax for the descendants axis in the VB 9.0 Xml members syntax. Before I go into the reasoning for that choice here is a small example of the triple dot syntax. In the following sample, the variable "authors" pointes to all the "author" elements that are descendents of the "book" element:

Dim book = <book year="2000">

  <title>Data on the Web</title>

  <authors>

                 <author>Serge Abiteboul</author>

                 <author>Peter Buneman</author>

                 <author>Dan Suciu</author>

              </authors>

           </book>

Dim authors = book...<author>

This statement is compiled to the following statement using the XLinq API:

Dim authors = book.Descendants("author")

We got many suggestions for alternative syntax, the most popular suggestion was to use double dot based on the logic that a single dot maps to XPath single slash thus the double dot should map to double slashes. Another suggestion was to use slashes after the dot or to add them to the element name. Another one was to use a different notation inside the angle brackets such as “*” or just empty tag, for example book.<*>.<author>.

The following are the reasons that this syntax was chosen by the language designers (the incubation work that led to the Xml features in VB 9.0) and the reasons we are keeping it:

  • The double dot is the XPath, DOS and Unix notation for parent.
  • The triple dot notation is already used by some applications such as our source control program for descendants.
  • Triple dot is often used to denote ellipsis (i.e. etc.) in English. The descendants axis in XPath and the descendants method in XLinq are somewhat similar to this concept since it allows omitting parts of the path that are not important.
  • Triple dot is more visible then two dots, the visual difference between single dot to double dot is smaller them between single to double slash.

Please continue to let us know what you think, your feedback is very important to us.

Avner