Anthony D. Green [MSFT]Anthony D. Green [MSFT]

My feedback

  1. 1,624 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      14 comments  ·  Visual Studio IDE » Languages - C#  ·  Flag idea as inappropriate…  ·  Admin →
      Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

      Actually, UserVoice is still an appropriate place to file language suggestions. The GitHub project is also a place where language ideas and more formal proposals are written up but the voting mechanism of UserVoice is quite valuable. We try to use the two sites in tandem.

    • 702 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        under review  ·  23 comments  ·  Visual Studio IDE » Extensibility  ·  Flag idea as inappropriate…  ·  Admin →
        Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

        Extend how? We were discussing something like this in a Roslyn diagnostics meeting and I'm curious what scenarios you're envisioning.

        -ADG

      • 147 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          4 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
          Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

          Hey all,

          I've thought about things like this and here are some of my thoughts on the matter.

          More often than not when I use optional parameters in VB the default value I'm using is a null value:

          Optional s As String = Nothing,
          Optional formatter as IFormatProvider = Nothing

          So, we have two cases: places where getting rid of the modifier would clean up code and places where cleaning up the default value expression would clean up code. How to choose? We could maybe require one or the other but not both?

          That's the first thorny issue. The second is that it's wholly against the spirit of the VB language to let the optionality of the parameter be inferred from a default value expression. C# stylistically prefers a terse syntax where if you remember the right sequence of symbols to attach to something can drastically alter its meaning:

          In C# the difference between declaring a field and a property is knowing to use the curly braces after the name {}.
          In VB there's the Property keyword.

          In C# a method that doesn't return a value is designated by a special return type 'void'.
          In VB there's the Sub keyword.

          In C# an iterator method is one that happens to include 'yield return' statements.
          In VB it's a method declared with the Iterator keyword.

          There are several reasons for this pattern in VB:
          1) Keywords tell you what to call things. If you don't have a keyword you won't know what to call it. If you don't know what to call it it's harder to look up help about it on the internet. Imagine some newer developer trying to bing "parameters with equals on them". Names matter.
          2) Keywords give you a great places to put your cursor and hit F1 to jump to the help topic, or hover over for context help. This makes it easier to learn the language. I learned QuickBasic (many years ago) almost entirely this way.
          3) Keywords often make for better IDE experiences because the IDE knows what help to provide based on what keywords have been typed so far.
          4) Keywords make features of the language more discoverable. If you're unfamiliar with the language and you begin to declare a parameter the IntelliSense suggests the modifiers you could use (ByVal, ByRef, ParamArray, and Optional) letting you know that such things exist.

          Not all of these things necessarily apply all the time but philosophically it's just a way the languages are different. Co-evolution is in no way an effort to make the languages the same but to respect the strengths and styles of each while enabling developers in either to take full advantage of the power and flexibility of Visual Studio and the .NET ecosystem. VB's never going to be as terse as C# and it's not really a goal for it to be. Each language just tries to be itself to the max it can so customers with particular styles gravitate toward the one that resonates most with them.

          This is a little different from the ByVal change because ByVal was already optional (it's the default). We'd been inserting it because in VB6 ByRef was the default and that was changed in .NET so we needed to keep reminding people that the language had changed. After 8 years we figure people got the point so we just fixed the IDE to stop automatically inserting it. The Optional keyword is actually required (ironically).

          It is, however, completely consistent with the language if the default values of optional parameters are the default values of the types of the parameters because that's what 'default' means. Every variable of a type has a default value (Nothing) if not otherwise set. It's wholly redundant to say that "if omitted the default value of this parameter will be the default value".

          Anyway, that's my current thinking on it.

          Regards,

          -Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

        • 76 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            12 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →

            Hey everyone,

            If you hadn’t heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by “Roslyn”. You can download this preview and install it on top of Visual Studio 2013 today!

            I’m excited to let you know that included in this is a preview of a new language feature we’re considering that let’s you Select Case on the type of an object like this:

            Select Case obj
            Case b As Button

            Case t As TextBox

            End Case

            You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

            Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

            I encourage you all to download it, try it out, and send us your feedback.

            Regards,

            Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

            Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

            Hey Charles,

            If you hadn't heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by "Roslyn". You can download this preview and install it on top of Visual Studio 2013 today!

            I'm excited to let you know that included in this is a preview of a new language feature we're considering: Select Case on type. It gets *really* close to what you're asking for - it just requires using a different name (the individual cases can have the same name, they just can't be the same as a variable or parameter that's already been declared):

            Public Function DoStuff(V As Object) As String
            Select Case V
            Case V2 As String
            Return V2
            Case V2 As Double
            Return V2.ToString("0.0")
            Case V2 As String() When V2.Length > 0
            Return V2(0)
            Case Else
            Return ""
            End Select
            End Function

            You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

            Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

            I encourage you to download it, try it out, and send us your feedback.

            Regards,

            Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

            Anthony D. Green [MSFT]Anthony D. Green [MSFT] supported this idea  · 
          • 3 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              4 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
              Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

              Hey Steven,

              I took a look at this and one issue I see is the question of execution order. The linked post suggests that the When clause be evaluated before the Case conditions. This is inconsistent with how When clauses today work with Catch statements and how presumably they're work with another proposal we have for allowing Select Case on the type of an expression. In both cases the Where clause allows further filtering after a type check has succeeded, e.g.:

              Catch ex As COMException When ex.HResult = 5

              Case t As TextBox When t.IsReadOnly

              In fact, the When clause is pretty useless if we evaluate before the type check since it could easily throw a null-reference exception. Given this precedence in the language it would be inconsistent and confusing to evaluate the When before the other conditions on the line and would otherwise break the left-to-right order of the language. If the When clause were evaluated after the other conditions then the feature wouldn't get you any short-circuiting or side-effect saving benefit, it would only let evaluation of subsequent cases continue failing some other condition. That's still valuable but perhaps not the value you intended. With that in mind is this still something you'd find useful?

              -ADG

            • 15 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                2 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →

                Hey Chris,

                Excellent suggestion! When we introduced implicit line-continuation in VB2010 it was a very painful restriction that we had to leave in due to technical and schedule constrains that comments weren’t allowed after them. Happily, thanks to the improved parser architecture we use in Roslyn (a future version of VB/C#) we will be able to support it one day. In fact, in the Roslyn compilers comments are already supported after implicit line-continuation so I can write this:

                ’ Comment here

                Private _SomeField As String

                After we got that working it seemed reasonable to lift the restriction on normal, explicit line-continuation as well though we haven’t yet done so.

                While we do not currently have plans to address this issue in the next release of Visual Studio, we are reviewing suggestions now for future versions of VB in and beyond the Roslyn time-frame. We have not determined when that will…

                Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                Hey everyone,

                If you hadn't heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by "Roslyn". You can download this preview and install it on top of Visual Studio 2013 today!

                While the preview doesn't include support for multiline comments it does have limited support for comments in the middle of a line after an implicit line continuation:

                <DebuggerBrowsable(DebuggerBrowsableState.Never)> ' My reason why.
                Private _SomeField As String

                We'd like to extend this to work after explicit line continuations as well.

                You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

                Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

                I encourage you all to download it, try it out, and send us your feedback.

                Regards,

                Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

              • 3 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  4 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →

                  Hey gjuro,

                  We’ve considered inline/multiline comments in VB several times. In the past it’s been a very expensive thing to implement because of the way the language parser was designed and the way the IDE integrates with it. The VB and C# code bases are, for historical reasons, very different. Anyway, in Roslyn such a thing isn’t as difficult anymore but we still question the value. In fact “is it worth it” is the real obstacle at this point.

                  We don’t actually see much use of inline/multiline comments even in C# which makes us even more hesitant to add them to VB.

                  Now, what we have been able to make work in Roslyn is this:

                  Dim q = From x In y ’ This is a from clause
                  Where x < z ’ And this is the where
                  Select x ’ This select is redundant

                  That is, comments after implicit…

                  Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                  Hey everyone,

                  If you hadn't heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by "Roslyn". You can download this preview and install it on top of Visual Studio 2013 today!

                  While the preview doesn't include support for multiline comments it does have limited support for comments in the middle of a line after an implicit line continuation:

                  Dim value = MyFunction(a, ' This is the first parameter
                  b, ' This is the second parameter
                  c, ' You get the point
                  )

                  We'd like to extend this to work after explicit line continuations as well.

                  You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

                  Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

                  I encourage you all to download it, try it out, and send us your feedback.

                  Regards,

                  Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

                • 10 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    8 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                    Anthony D. Green [MSFT]Anthony D. Green [MSFT] supported this idea  · 
                  • 16 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      6 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →

                      Hey everyone,

                      If you hadn’t heard already last week at BUILD we announced the PUBLIC release of a Preview of the next version of the Visual Basic language and code editing experience powered by “Roslyn”. You can download this preview and install it on top of Visual Studio 2013 today!

                      I’m excited to let you know that included in this is a preview of a new language feature we’re considering: When clauses on Case statements. This behaves like an AND. It doesn’t do exactly as suggested because you can’t implicitly refer to the Select Case expression but you can test other conditions inside:

                      Select Case dblA
                      Case Is > 1.22 When Date.Today.DayOfWeek = DayOfWeek.Monday
                      ’ Why would anyone ever write this?
                      End Select

                      You can read about it more here: http://www.codeplex.com/Download?ProjectName=roslyn&DownloadId=824695

                      Download the End User Preview @ http://msdn.microsoft.com/en-US/vstudio/roslyn

                      I encourage you all to download it, try it out, and…

                    • 84 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        8 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                      • 327 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          under review  ·  28 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                          Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                          Hi again, PavlinII,

                          Thanks for all that feedback!

                          Here's the reason we're considering Output at the callsite - it would allow us to infer a variable declaration inline. Today because you need to declare the variable before hand you also need to specify its type explicitly and can't use type-inference. A lot of users, myself included, love type inference and this limitation creates an inconsistent experience. With an explicit Output keyword at the call site instead of typing this:

                          Dim result As Integer ' No type inference here.
                          If Integer.TryParse(stringVariable, result) Then ...

                          You could type:

                          If Integer.TryParse(stringVariable, Output result) Then ' With type of variable inferred.
                          or
                          If Integer.TryParse(stringVariable, Output result As Integer) Then ' With type of variable explicit.

                          Technically we could still do this without the Output keyword but it's a little harder to predict and see.

                          But, even if we did add this feature we'd need to still support doing it the way you do today for back-compat reasons.

                          Regards,

                          -ADG

                          Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                          Hi PavlinII,

                          Thanks for the suggestion. We thought pretty long and hard about this suggestion and can totally see the pros - particularly in scenarios where being concise is at a premium (like in lambdas), or where duplicate types are very common - user-defined binary operators. There is definitely precedent in the language for what this means. It also raises some interesting questions:

                          1) Modifiers/Attributes:
                          a) They distribute over the chain:

                          ' x and y are integers, both are ByRef.
                          Sub M(ByRef x, y As Integer)

                          b) They don't distribute:

                          ' x and y are integers, only x is ByRef.
                          Sub M(ByRef x, y As Integer)

                          c) They break the chain:

                          ' This is illegal. x has a modifier and must also declare a type explicitly to avoid ambiguity.
                          Sub M(ByRef x, y As Integer)

                          The existing rules today around modifiers/attributes on fields would suggest we'd go with (a) for this.

                          2) Intersection with possible (though not necessarily planned) future features:
                          a) What if we let you declare Optional parameters out of order?

                          ' These are all optional.
                          Sub M(Optional prefix, root, suffix As String)

                          But let's say you wanted only the first and last to be optional (yes, this scenario has come up) you could declare it like this:

                          Sub M(Optional prefix As String, root As String, Optional suffix As String)

                          Which might be fine and is probably clearer. But VB also supports a rapid-prototyping typeless style and you couldn't write this:

                          Sub M(Optional prefix, root, Optional suffix)

                          In fact in this mode you wouldn't be able to use any modifier without impacting any subsequent parameters in typeless mode. OK, so maybe we decide it either doesn't work in typeless mode or you're just forced to explicitly type out a type in this case.

                          b) Let's say we added Output parameters to VB. C# already supports them and they're a pretty common pattern in .NET for multiple return values and the TryXyz pattern (e.g. TryParse, Dictionary.TryGetValue)

                          Function Execute(path As String,
                          stdIn As Stream,
                          Output stdOut, stdErr As Stream
                          ) As Integer

                          This has the same problem as with Optionals - it's already possible today in C# to declare output parameters in any order. But like before we can require explicit typing in that edge case. Now let's look at the caller side:

                          exitCode = Execute("cmd.exe", stdIn, Output stdOut, stdErr)

                          Again the question of whether to distribute or not is a problem. If we don't support it you need to repeat the modifier:

                          exitCode = Execute("cmd.exe", stdIn, Output stdOut, Output stdErr)

                          It's odd that the use site doesn't follow the same rules as declaration, but maybe we can live with it.

                          If we don't support it then the original code works but now it's impossible for an Output parameter to precede any non-Output parameters:

                          M(Output x, y, Output z)

                          Maybe we work around this too by letting you force ByVal and ByRef on the middle argument where it's ambiguous?

                          M(Output x, ByVal y, Output z)

                          This is probably rare enough that this escape hatch is good, especially for output parameters. The case may not be so cut and dry for ByRef arguments. Now arguably when the argument passing mode changes mid argument list it's probably good to be more explicit but it does mean any translation from C# code would have to potentially know that but we could flag it with a warning or something.

                          Now, I'm not saying we're going to do any of these language features but it is important when deciding on any one how it might intersect with a future whole.

                          What do you guys think? Do any of these possible worlds sound confusing or make you think the feature is less desirable?

                          -Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

                        • 11 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            under review  ·  2 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                            Anthony D. Green [MSFT]Anthony D. Green [MSFT] supported this idea  · 
                            Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                            Hey Antao,

                            How do you feel about this syntax?:

                            Dim class1 = New Class1 With { .ListProp From { 1, 2, 3, 4, 5, 6, 7, 8, 9 } }

                            C# also supports initializing sub-properties of objects returned by read-only properties. In VB how would you feel about this syntax?:

                            Dim john = New Person With { .Name = "John Doe",
                            .Address With { .Street = "123 Main St", .City = "Redmond", .State = "WA" },
                            .PhoneNumbers From { "555-555-5551", "555-555-5552" } }

                            This is just an idea we've been playing around with and were curious what you and others thought. FWIW, the reason we didn't jsut match C# with the = { ... } syntax is because, as you've noted the properties are read-only so a syntax which suggests assigning to them, at least in VB is crazy. Also, VB already has a meaning for the { ... } syntax which is to create an array literal so it's helpful to use the With or From keywords as disambiguator from the case where you're actually assigning an array literal to a mutable property.

                            Regards,

                            -ADG

                          • 5 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              under review  ·  2 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                              Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                              What if when you defined = the IDE autogenerated the body of the <> like that?

                              -Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

                            • 10 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                under review  ·  5 comments  ·  Visual Studio IDE » Languages - Visual Basic  ·  Flag idea as inappropriate…  ·  Admin →
                                Anthony D. Green [MSFT]Anthony D. Green [MSFT] commented  · 

                                How would you feel about this:

                                With x As New Cheese
                                .CheeseType = cheeseType
                                .Curdle()
                                Helpers.DoSomething(x)
                                Return x
                                End With

                                -Anthony D. Green, Program Manager, Visual Basic & C# Languages Team

                              • 220 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  3 comments  ·  Visual Studio IDE » Project  ·  Flag idea as inappropriate…  ·  Admin →
                                  Anthony D. Green [MSFT]Anthony D. Green [MSFT] supported this idea  · 

                                Feedback and Knowledge Base