Lucian Wischik: What's New in VB11
- Posted: Mar 29, 2012 at 4:19 PM
- 34,994 Views
- 11 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Lucian Wischik, the Visual Basic language Program Manager, digs into many of the new features in VB11. This was recorded at DevConnections a few days ago.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
The 'For Each Lifting' feature is very useful, I have a lot of this in my code, my solution was passing the value of iterator as a parameter of the lambda, but auto lifting will be much better. does this work for C# ?
And, Lucian has another talk about Async at DevConnections, was that recorded ?
Lucian, I noticed something strange when you did the Hello World part at the beginning.
When using the "traditional" methods, the game it background continued to play, but when demo the Async approach, it seem (to me) to run synchronously. ie the Message Popup appeared then the game ran.
Was this an artefact of Async, the rest of code following this is lifted into a continuation?
@felix9: The audio for Lucian's Async talk is unfortunately not up to snuff for airing on C9. That said, we are hosting the files in our cloud for Lucian (he'll link to them from his blog).
You can watch it here (since it's screen capture + audio, I'm supplying links to the high quality media below) :
HQ WMV: http://media.ch9.ms/ch9/b8c8/c31a592d-42d3-4e65-810f-a41280b0b8c8/LucianWischikAsync_Source.wmv
HQ MP4: http://media.ch9.ms/ch9/b8c8/c31a592d-42d3-4e65-810f-a41280b0b8c8/LucianWischikAsync_high.mp4
C
@Felix: yes the "foreach lifting" is also in C#5. And, it will apply even if you're using VS11/C#5 and downtargeting to older frameworks.
@Felix: in addition to the video of the async talk, there are also the slides and script and source code on my blog: http://blogs.msdn.com/b/lucian/archive/2012/03/29/talk-async-part-1-the-message-loop-and-the-task-type.aspx (The audio quality is terribly for the first few minutes, but gets a little better...)
@Adam: Yes precisely: the await keyword lifted everything else into the continuation...
In the traditional code I wrote
op1 = New MessageDialog("hello").ShowAsync()
op1.Completed = Sub() Dispatcher.InvokeAsync(Sub()
op2 = New MessageDialog("world").ShowAsync()
End Sub)
PlayRestOfGame()
Note that "PlayRestOfGame" was started immediately after the first dialogbox appeared.
Meanwhile, in the await code, I wrote
Await New MessageDialog("hello").ShowAsync()
Await New MessageDialog("world").ShowAsync()
PlayRestOfGame()
This caused the rest of the game to start only after the second dialog had finished.
Could I have written traditional code to play the game only after the second dialog had finished? Yes, I'd do it with "op2.Completed = Sub() PlayRestOfGame()"
Could I have written the async code to play the game while the dialogs were still doing there stuff? Yes, I might do something like this:
Dim background_task = ShowDialogsAsync() ' kick off the dialogs
PlayRestOfGame() ' but, without awaiting it, let's just get on with the game
Async Sub ShowDialogsAsync()
Await New MessageDialog("hello").ShowAsync()
Await New MessageDialog("world").ShowAsync()
End Sub
Lucian, I just finished watching this podcast, and I've got a question for you. You mentioned that VB11 now doesn't require the ByVal and ByRef keywords on the parameters for Sub and Function declarations. I think that's great! I'm wondering if value objects, like Integer, Float, etc are passed by value, by default? And does that apply to String objects as well? How about regular objects (non-value objects)? Are they passed by reference, by default? And what if you want to pass an value object by reference? Do you then use the ByRef keyword?
Right at the beginning you mentioned it was a small crowd. I suppose my question is, does Microsoft plan to support and grow Vb indefinitely? I love VB, and have used it for years. However, finding talented VB developers is increasingly difficult. As I add functionality to my company's product, I must consider the decreasing VB talent pool.
@Doctor Who:
ByVal is implicit now: if you omit ByVal/ByRef, then the compiler treats the parameter as ByVal. If you want anything passed by reference, you still need ByRef. Other than that, it's exactly how it always was.
It's hard to answer your individual questions directly since the answers are more confusing than enlightening... ("What do you mean you're passing my reference by value?!?!!"). Nevertheless: by default everything is passed by value; String objects are immutable references and like all references they are by default passed by value; when you pass a reference to a regular reference-type, the reference is passed by value; if you want to pass a value-type by reference then yes you use ByRef.
@Matt:
Absolutely. We've already said that we're committed to VB. And you can see we're putting our money where our mouth is -- with the huge slate of new features in VB11, with the exciting developments forthcoming in Roslyn, and with all the new platforms that are supporting VB (including most recently Gadgeteer). My personal opinion is that if a professional .NET developer claims they can't read C# or VB or F#, then I'd hesitate to call them a professional...
ada-ada jach deh
fgfgfgfgfg
fgfgfgfgfg
@ljw1004: Thank you, for your explanation, I appreciate it.
Remove this comment
Remove this thread
close