Where are Programming Languages...
Transcript of Where are Programming Languages...
![Page 1: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/1.jpg)
Where are Programming
Languages Going?
Anders Hejlsberg
Microsoft Technical Fellow
![Page 2: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/2.jpg)
![Page 3: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/3.jpg)
Since then…
x 10,000
x 100,000
x 1000
![Page 4: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/4.jpg)
But…
program HelloWorld;var
I: Integer;begin
for I := 1 to 10 doWriteLn('Hello World');
end.
x ?
using System;
class HelloWorld{
static void Main(string[] args) {for (int i = 0; i < 10; i++)
Console.WriteLine("Hello World");
}}
=
![Page 5: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/5.jpg)
Languages, Frameworks, Tools
Then
Now
![Page 6: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/6.jpg)
Increasing Abstraction Level
![Page 7: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/7.jpg)
Trends
![Page 8: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/8.jpg)
Declarative Programming
What
How
Imperative Declarative
![Page 9: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/9.jpg)
Domain Specific Languages
“… a programming language or
specification language dedicated to a
particular problem domain, a
particular problem representation
technique, and/or a particular
solution technique.”Source: Wikipedia
![Page 10: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/10.jpg)
Domain Specific Languages
DSLGPPL
GPPL
DSL
External DSL Internal DSL
![Page 11: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/11.jpg)
External DSLs
<?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/> <xsl:template match="/persons">
<root><xsl:apply-templates select="person"/></root></xsl:template> <xsl:template match="person">
<name id="{@username}"><xsl:value-of select="name"/></name></xsl:template>
</xsl:stylesheet>
SELECT Name, Address, CityFROM CustomersWHERE Country = "Denmark" rm -f /tmp/listing.tmp > /dev/null 2>&1
touch /tmp/listing.tmpls -l [a-z]*.doc | sort > /tmp/listing.tmplpr -Ppostscript_1 /tmp/listing.tmprm -f /tmp/listing.tmp
![Page 12: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/12.jpg)
Internal DSLs
class Order < ActiveRecord::Basebelongs_to :customerhas_many :details
end
var query = db.Customers.Where(c => c.City == "London").OrderBy(c => c.CompanyName).Select(c => c.CompanyName);
Pattern socialSecurityNumber = Pattern.With.AtBeginning.Digit.Repeat.Exactly(3).Literal("-").Repeat.Optional.Digit.Repeat.Exactly(2).Literal("-").Repeat.Optional.Digit.Repeat.Exactly(4).AtEnd;
![Page 13: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/13.jpg)
LINQ Demo
![Page 14: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/14.jpg)
Functional Programming
FP
First class functions
Immutable
data
Referential
transparency
Algebraic data types
Type
inference
Pattern
matching
![Page 15: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/15.jpg)
Imperative vs. Functional
x = x + 1
![Page 16: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/16.jpg)
Imperative vs. Functional
y = x + 1
![Page 17: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/17.jpg)
public class Point{
public int x;public int y;
public Point(int x, int y) {this.x = x;this.y = y;
}
public void MoveBy(int dx, int dy) {x += dx;y += dy;
}}
public class Point{
public readonly int x;public readonly int y;
public Point(int x, int y) {this.x = x;this.y = y;
}
public Point MoveBy(int dx, int dy) {return new Point(x + dx, y + dy);
}}
Imperative vs. Functional
ImperativeImperative
FunctionalFunctional
![Page 18: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/18.jpg)
F#
![Page 19: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/19.jpg)
F# Demo
![Page 20: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/20.jpg)
Dynamic vs. Static
![Page 21: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/21.jpg)
Meta-Programming
“Meta-programming is the writing of
programs that write or manipulate
other programs (or themselves) as
their data…”Source: Wikipedia
class Order < ActiveRecord::Basebelongs_to :customerhas_many :details
end
![Page 22: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/22.jpg)
.NET Dynamic Programming
Dynamic Language Runtime
IronPythonIronPythonIronPython IronRubyIronRubyIronRuby C#C#C# VB.NETVB.NETVB.NET Others…OthersOthers……
Statement TreesStatement TreesStatement Trees Dynamic DispatchDynamic DispatchDynamic Dispatch Call Site CachingCall Site CachingCall Site Caching
Python
Binder
PythonPython
BinderBinderRuby
Binder
RubyRuby
BinderBinderCOM
Binder
COMCOM
BinderBinderJavaScript
Binder
JavaScriptJavaScript
BinderBinderObject
Binder
ObjectObject
BinderBinder
![Page 23: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/23.jpg)
Static and Dynamic
Calculator calc = GetCalculator();int sum = calc.Add(10, 20);
object calc = GetCalculator();Type calcType = calc.GetType();object res = calcType.InvokeMember("Add",
BindingFlags.InvokeMethod, null,new int[] { 10, 20 });
int sum = Convert.ToInt32(res);ScriptObject calc = GetCalculator();object res = calc.Invoke("Add", 10, 20);int sum = Convert.ToInt32(res);
dynamic calc = GetCalculator();int sum = calc.Add(10, 20);
Statically typed to
be dynamic
Statically typed to
be dynamic
Dynamic method
invocation
Dynamic method
invocationDynamic
conversion
Dynamic
conversion
![Page 24: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/24.jpg)
Concurrency
![Page 25: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/25.jpg)
Operating System ThreadsOperating System Threads
Parallel Extensions for .NET
Parallel LINQParallel LINQ
Task Parallel LibraryTask Parallel LibraryCoordination Data
Structures
Coordination Data
Structures
CPUCPU CPUCPU …CPUCPU CPUCPU
![Page 26: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/26.jpg)
Parallel Extensions Demo
![Page 27: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/27.jpg)
Potential Language Constructs
![Page 28: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/28.jpg)
Interesting Times
Ruby
Python C#Java
Jav
aS
crip
t
ScalaE
rla
ng
F#
Fo
rtre
ssNemerleBooGroovy
PHP
PerlLua
PowerShell
D
C+
+
![Page 29: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/29.jpg)
Resources
http://msdn.microsoft.com/fsharp
http://msdn.microsoft.com/concurrency
![Page 30: Where are Programming Languages Goingjaoo.dk/dl/jaoo-aarhus-2008/slides/AndersHejlsberg_WhereAreProgra… · Meta-Programming “Meta-programming is the writing of programs that write](https://reader034.fdocuments.net/reader034/viewer/2022042621/5f64246ed8f64507e749d5d6/html5/thumbnails/30.jpg)
© 2007 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.