Inconsistancies between May CTP and documentation

I'm reading through the VB 9 overview documentation and am finding a number of cases where the documentation does not appear to agree with the current CTP. I would be interested in knowing if these are features not yet implemented or errors in the documentation.

1) The documentation states that the query comprehensions are compositional which should mean that the order of the expressions should not matter. Thus you should be able to interchange the order clause with the select clause. However, it appears that the compiler requires the order by clause to appear after the select clause in the recent drop. For instance, while the following is perfectly valid:

Dim di As New System.IO.DirectoryInfo("C:\windows")
Dim result = From f In di.GetFiles _
  
Where f.Extension = ".exe" _
  
Select f.Name _
  
Order By Name

The inverse generates an exception:

Dim di As New System.IO.DirectoryInfo("C:\windows")
Dim result = From f In di.GetFiles _
  
Where f.Extension = ".exe" _
   Order By Name _
  
Select f.Name

Note, the latter is indicated as correct in the documentation (see the sample on page 9).

2) The C# style code for nullable types does not seem to work as indicated in section 1.8 of the VB9 overview document. The logic evaluations work, but standard arithmetic operators are not working for nullable value types. For instance, you can't do the following although the documentation indicates that is possible.

Dim x As Integer
Dim y As Integer
Console.WriteLine("2 + null = " & (x + y).tostring)

I'll need to look at sections 1.9+ later.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx




Answer this question

Inconsistancies between May CTP and documentation

  • MikeTheFid

    You are correct the ordering of queries is important for from, where, and order by clauses.
    On your other point you mention the C# style guide but have shown a VB example. The following C# does perform as expected.
    static void Main(string[] args) {
    int x = null;
    int y = null;
    Console.WriteLine("2 + null = " + (x+y).ToString());
    }


  • gc_asd

    Yes, however the VB 9 guide states that is should be possible in VB as well. I suspect that the VB guide just copied the section from the C# guide without testing it first.

  • Inconsistancies between May CTP and documentation