karen liu microsoft dev 339download.microsoft.com/documents/hk/technet/techdays2009/...source...

27

Upload: others

Post on 04-Nov-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print
Page 2: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Karen LiuIDE Lead Program ManagerMicrosoftDev 339

Page 3: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

The Evolution of Visual Basic

Visual Basic

1.0-3.0Visual Basic

4.0-6.0

Visual Basic

7.0-9.0

Visual Basic 10.0

Visual Basic 11.0+

Page 4: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

VB's Fraternal Twin: C#Co-Evolution

Page 5: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Trends

Declarative

ConcurrentDynamic

Page 6: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Declarative Programming

What

How

Imperative Declarative

Page 7: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Dynamic vs. Static

DynamicLanguages

Simple and succinct

Implicitly typed

Meta-programming

No compilation

StaticLanguages

Robust

Performant

Intelligent tools

Better scaling

Page 8: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Concurrency

Page 9: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

VB 10 Language FeaturesKaren LiuVB/C# IDE Lead Program ManagerMicrosoft

Page 10: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

What you saw

Implicit line continuation

Automatically implemented properties

Collection initializers

Array literals

Statement lambdas

Page 11: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Implicit Line Continuation

<Attribute()>Function Go(

ByVal x As Integer,ByVal y As Integer

)

Dim query =From n In {

123,456,}

Order By nSelect n +

x

Page 12: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Auto-implemented Properties

Property FirstName As String

Property LastName As String

Initializers:

Property ID As Integer = -1

Property Suppliers As New List(Of Supplier)

Page 13: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Collection Initializers

Dim x As New List(Of Integer) From {1, 2, 3}

Dim list As New Dictionary(Of Integer, String) From

{{1, “Bart”},

{2, “Lisa”},

{3, “Homer”}}

Array Literals:

Dim a = {1, 2, 3} 'infers Integer()

Dim b = {1, 2, 3.5} 'infers Double()

Page 14: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Statement Lambdas

Dim items = {1, 2, 3, 4, 5}

Array.ForEach(items, Sub(n) Console.WriteLine(n))

Array.ForEach(items, Sub(n)

If n Mod 2 = 0 Then Console.WriteLine(n)End Sub)

'Count the number of even items in the arrayDim total = items.Count(Function(n)

Return (n Mod 2 = 0)End Function)

Page 15: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

PythonBinder

RubyBinder

COMBinder

JavaScriptBinder

ObjectBinder

.NET Dynamic Programming

Dynamic Language Runtime

Expression Trees Dynamic Dispatch Call Site Caching

IronPython IronRuby C# VB.NET Others…

Page 16: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

VB 10 –Dynamic InteropKaren LiuIDE Lead Program ManagerMicrosoft

Page 17: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Interop with Dynamic Languages

'Load a file from Python into memoryDim random As Object = python.UseFile("random.py")

Dim items = {1, 2, 3, 4, 5, 6, 7}

'Dynamic (late-bound) call to Python functionrandom.shuffle(items)

'Print out the shuffled arrayArray.ForEach(items, Sub(n) Console.WriteLine(n))

Page 18: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Interop Type Embedding ("No Pia")

• Use PIAs at design-time, not runtime

• No need to deploy PIA to user’s machine

• Compiler embeds the specific members of the specific types used into your assembly

Page 19: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Compiler as a Service

CompilerCompilerSource codeSource code

SourceFile

Source codeSource code

.NET Assembly

Class

Field

public Foo

private

string

X

Meta-programming Read-Eval-Print Loop

LanguageObject Model

DSL Embedding

Page 20: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Compiler as a ServiceKaren LiuVB/C# IDE Lead Program ManagerMicrosoft

Page 21: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Summary

Declarative

ConcurrentDynamic

Page 22: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print
Page 23: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

http://microsoft.com/technet

Resources for IT Professionals

http://microsoft.com/msdn

Resources for Developers

www.microsoft.com/learning

Microsoft Certification & Training Resources

Resources

Page 24: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Related Content

Dev352 (R) – Increase Your Productivity with the Visual Studio 2010 IDE

DTL339 (R) – Future Directions for Microsoft Visual Basic

Dev423 – How LINQ Works: A Deep Dive into the Microsoft Visual Basic and C# Implementations

Page 25: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Track Resources

VB Team Blog – http://blogs.msdn.com/vbteamBeth Massi’s Blog - http://blogs.msdn.com/bethmassi

MSDN VBasic Site – http://msdn.com/vbasic

VB 10 Whitepaper -http://code.msdn.microsoft.com/vbfuture/Release/ProjectReleases.aspx?ReleaseId=1699

VB Developer Center - http://msdn.com/vbasic

Questions? Comments? Requests? Email me at [email protected]

Page 26: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

Complete an

evaluation on

CommNet and

enter to win!

Page 27: Karen Liu Microsoft Dev 339download.microsoft.com/documents/hk/technet/techdays2009/...Source code.NET Assembly Class Field public Foo private string X Meta-programming Read-Eval-Print

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.