Commit 6c2e0fe1 authored by Russ Cox's avatar Russ Cox

create doc/talks/.

move talk-20091030 down.
add talk given at Stanford 2010/01/12.
add doc/go-logo-white.png.

R=r
CC=golang-dev
https://golang.org/cl/186132
parent 27be2915
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Go (January 12, 2010)</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="font-size-adjustment" content="-1" />
<link rel="stylesheet" href="slidy.css"
type="text/css" media="screen, projection, print" />
<script src="slidy.js" type="text/javascript">
</script>
</head>
<body>
<!-- this defines the slide background -->
<div class="background">
<div class="header">
<!-- sized and colored via CSS -->
</div>
<div class="footer"></div>
</div>
<div class="slide titlepage">
<div style="height: 135px; width: 480px; overflow: hidden; position: fixed; top: auto; bottom: 10px; left: auto; right: 0; ">
<img src="../gordon/bumper480x270.png" style="margin: -135px 0 0 0;"/>
</div>
<!-- <img src="google.png" style="position: fixed; top: auto; bottom: 30px; left: 20px; right: auto;"/> -->
<br/>
<img src="../go-logo-white.png">
<br/>
<br/>
<h1 style="padding-right: 0pt; margin-right: 0pt; color: #0066cc; font-size: 250%; border-bottom: 0px;">The Go Programming Language</h1>
<div style="color: #ffcc00;">
<h2>Russ Cox</h2>
<!-- <h3><i>rsc@google.com</i></h3> -->
<br/>
<h3>Stanford University<br/><br/>January 12, 2010</h3>
</div>
</div>
<div class="slide">
<h1>Go</h1>
<h2>New</h2>
<h2>Experimental</h2>
<h2>Concurrent</h2>
<h2>Garbage-collected</h2>
<h2>Systems</h2>
<h2>Language</h2>
</div>
<div class="slide">
<h1>Hello, world</h1>
<pre>
package main
import "fmt"
func main() {
fmt.Printf("Hello, 世界\n")
}
</pre>
</div>
<div class="slide">
<h1>History</h1>
<h2>Design started in late 2007.</h2>
<h2>Implementation starting to work mid-2008.</h2>
<h2>Released as an open source project in November 2009.</h2>
<h2>Work continues.<h2>
<h2>Robert&nbsp;Griesemer, Ken&nbsp;Thompson, Rob&nbsp;Pike, Ian&nbsp;Lance&nbsp;Taylor, Russ&nbsp;Cox, many others</h2>
</div>
<div class="slide">
<h1>Why?</h1>
<h2>Go fast!</h2>
<h2>Make programming fun again.</h2>
</div>
<div class="slide">
<h1>Why isn't programming fun?</h1>
<div class="incremental">
<h2>Compiled, statically-typed languages (C, C++, Java) require too much typing and too much typing:</h2>
<ul>
<li>verbose, lots of repetition</li>
<li>too much focus on type hierarchy</li>
<li>types get in the way as much as they help</li>
<li>compiles take far too long</li>
</ul>
</div>
<div class="incremental">
<h2>Dynamic languages (Python, JavaScript) fix these problems (no more types, no more compiler) but introduce others:</h2>
<ul>
<li>errors at run time that should be caught statically</li>
<li>no compilation means slow code</li>
</ul>
</div>
<h2 class="incremental">Can we combine the best of both?</h2>
</div>
<div class="slide">
<h1>Go</h1>
<h2>Make the language fast.</h2>
<h2>Make the tools fast.</h2>
</div>
<div class="slide">
<h1>Go Approach: Static Types</h1>
<h2>Static types, but declarations can infer type from expression:</h2>
<pre>
var one, hi = 1, "hello"
var double = func(x int) int { return x*2 }
</pre>
<h2>Not full Hindley-Milner type inference.</h2>
</div>
<div class="slide">
<h1>Go Approach: Methods</h1>
<h2>Methods can be defined on any type.</h2>
<pre>
type Point struct {
X, Y float64
}
func (p Point) Abs() float64 {
return math.Sqrt(p.X*p.X + p.Y*p.Y)
}
</pre>
</div>
<div class="slide">
<h1>Go Approach: Methods</h1>
<h2>Methods can be defined on any type.</h2>
<pre>
type MyFloat float64
func (f MyFloat) Abs() float64 {
v := float64(f)
if v < 0 {
v = -v
}
return v
}
</pre>
</div>
<div class="slide">
<h1>Go Approach: Abstract Types</h1>
<h2>An interface type lists a set of methods. Any value with those methods satisfies the interface.</h2>
<pre>
type Abser interface {
Abs() float64
}
func AbsPrinter(a Abser)
</pre>
<h2>Can use Point or MyFloat (or ...):</h2>
<pre>
p := Point{3, 4}
AbsPrinter(p)
f := MyFloat(-10)
AbsPrinter(f)
</pre>
<h2>Notice that Point never declared that it implements Abser. It just does. Same with MyFloat.</h2>
</div>
<div class="slide">
<h1>Go Approach: Packages</h1>
<h2>A Go program comprises one or more packages.</h2>
<h2>Each package is one or more source files compiled and imported as a unit.</h2>
<pre>
package draw
type Point struct {
X, Y int
}
</pre>
<pre>
package main
import "draw"
var p draw.Point
</pre>
</div>
<div class="slide">
<h1>Go Approach: Visibility</h1>
<h2>Inside a package, all locally defined names are visible in all source files.</h2>
<h2>When imported, only the upper case names are visible.</h2>
<pre>
package draw
type <span style="color: black;">Point</span> struct {
<span style="color: black;">X</span>, <span style="color: black;">Y</span> int
dist float64
}
type cache map[Point] float64
</pre>
<h2>Clients that <code>import "draw"</code> can use the black names only.</h2>
<h2>&ldquo;Shift is the new <code>public</code>.&rdquo;</h2>
</div>
<div class="slide">
<h1>Go Approach: Concurrency</h1>
<h2>Cheap to create a new flow of control (goroutine):</h2>
<pre>
func main() {
go expensiveComputation(x, y, z)
anotherExpensiveComputation(a, b, c)
}
</pre>
<h2>Two expensive computations in parallel.</h2>
</div>
<div class="slide">
<h1>Go Approach: Synchronization</h1>
<h2>Use explicit messages to communicate and synchronize.</h2>
<pre>
func computeAndSend(c chan int, x, y, z int) {
c <- expensiveComputation(x, y, z)
}
func main() {
c := make(chan int)
go computeAndSend(c, x, y, z)
v2 := anotherExpensiveComputation(a, b, c)
v1 := <-c
fmt.Println(v1, v2)
}
</pre>
<h2>Notice communication of result in addition to synchronization.</h2>
</div>
<div class="slide">
<h1>Go Fast: Language</h1>
<h2 class="incremental">Static types: enough to compile well, but inferred much of the time.</h2>
<h2 class="incremental">Methods: on any type, orthogonal to type system.</h2>
<h2 class="incremental">Abstract types: interface values, relations inferred statically.</h2>
<h2 class="incremental">Visibility: inferred from case of name.</h2>
<h2 class="incremental">Concurrency: lightweight way to start new thread of control.</h2>
<h2 class="incremental">Synchronization: explicit, easy message passing.</h2>
<br/>
<h2 class="incremental">Lightweight feel of a scripting language but compiled.</h2>
</div>
<div class="slide">
<h1>Compile fast</h1>
<div class="incremental">
<h2>Observation: much of the compile time for a source file is spent processing
other, often unrelated files.</h2>
<h2>In C: <code>a.c</code> includes <code>b.h</code>, which includes <code>c.h</code>, which includes <code>d.h</code>.
</h2>
<h2>Except that it's more often a tree instead of a chain.</h2>
<h2>On my Mac (OS X 10.5.8, gcc 4.0.1):</h2>
<ul>
<li>C: <code>#include &lt;stdio.h&gt;</code> reads 360 lines from 9 files.
<li>C++: <code>#include &lt;iostream&gt;</code> reads 25,326 lines from 131 files.
<li>Objective C: <code>#include &lt;Carbon/Carbon.h&gt;</code> reads 124,730 lines from 689 files.
</ul>
<h2>And we haven't done any real work yet!</h2>
<h2>Same story in Java, Python, but reading binaries instead of source files.</h2>
</div>
</div>
<div class="slide">
<h1>Implementation: Summarize Dependencies</h1>
<pre>
package gui
import "draw"
type Mouse struct {
Loc draw.Point
Buttons uint
}
</pre>
<h2>Compiled form of <code>gui</code> summarizes the necessary part of <code>draw</code> (just <code>Point</code>).</h2>
</div>
<div class="slide">
<h1>Implementation: Summarize Dependencies</h1>
<h2>Compiled form of <code>gui</code> summarizes the necessary part of <code>draw</code> (just <code>Point</code>). Pseudo-object:</h2>
<pre>
package gui
type draw.Point struct {
X, Y int
}
type gui.Mouse struct {
Loc draw.Point
Buttons uint
}
</pre>
<h2>A file that imports <code>gui</code> compiles without consulting <code>draw</code> or its dependencies.</h2>
<h2>In Go: <code>import "fmt"</code> reads <i>one</i> file: 184 lines summarizing types from 7 packages.</h2>
<h2>Tiny effect in this program but can be exponential in large programs.</h2>
</div>
<div class="slide">
<h1>Compilation Demo</h1>
<h2>Build all standard Go packages: ~120,000 lines of code.</h2>
</div>
<div class="slide">
<h1>Go Status</h1>
<div class="incremental">
<div>
<h2>Open source:</h2>
<ul>
<li>released on November 10, 2009
<li>regular releases (~ weekly)
<li>all development done in public Mercurial repository
<li>outside contributions welcome
</ul>
</div>
<div>
<h2>Portable:</h2>
<ul>
<li>FreeBSD, Linux, OS X (x86, x86-64)
<li>(in progress) Linux arm, Native Client x86, Windows x86.
</ul>
</div>
<div>
<h2>Still in progress, experimental. Yet to come:</h2>
<ul>
<li>mature garbage collector
<li>generics?
<li>exceptions?
<li>unions or sum types?
</ul>
</div>
</div>
</div>
<div class="slide titlepage">
<h1>Questions?</h1>
<br><br>
<center>
<img src="../gordon/bumper640x360.png">
</center>
<br><br>
<div style="color: #ffcc00;">
<!-- <h3><i>rsc@google.com</i></h3> -->
</div>
</div>
</body></html>
/* http://www.w3.org/Talks/Tools/Slidy/slidy.css
Copyright (c) 2005 W3C (MIT, ERCIM, Keio), All Rights Reserved.
W3C liability, trademark, document use and software licensing
rules apply, see:
http://www.w3.org/Consortium/Legal/copyright-documents
http://www.w3.org/Consortium/Legal/copyright-software
*/
body
{
margin: 0 0 0 0;
padding: 0 0 0 0;
width: 100%;
height: 100%;
color: black;
background-color: white;
font-family: "Lucida Sans", "Lucida Grande", Lucida, sans-serif;
font-size: 14pt;
}
.hidden { display: none; visibility: hidden }
div.toolbar {
position: fixed; z-index: 200;
top: auto; bottom: 0; left: 0; right: 0;
height: 1.2em; text-align: right;
padding-left: 1em;
padding-right: 1em;
font-size: 60%;
color: red; background: rgb(240,240,240);
}
div.background {
display: none;
}
div.handout {
margin-left: 20px;
margin-right: 20px;
}
div.slide.titlepage {
color: white;
background: black;
text-align: center;
}
div.slide {
z-index: 20;
margin: 0 0 0 0;
padding-top: 0;
padding-bottom: 0;
padding-left: 20px;
padding-right: 20px;
border-width: 0;
top: 0;
bottom: 0;
left: 0;
right: 0;
line-height: 120%;
background-color: transparent;
}
/* this rule is hidden from IE 6 and below which don't support + selector */
div.slide + div[class].slide { page-break-before: always;}
div.slide h1 {
padding-left: 20px;
padding-right: 20px;
padding-top: 10px;
padding-bottom: 10px;
margin-top: 0;
margin-left: 0;
margin-right: 0;
margin-bottom: 0.5em;
border-bottom: 4px solid #36c;
display: block;
font-size: 160%;
line-height: 1.2em;
}
div.slide h2 {
font-size:120%;
line-height: 1.2em;
}
div.toc {
position: absolute;
top: auto;
bottom: 4em;
left: 4em;
right: auto;
width: 60%;
max-width: 30em;
height: 30em;
border: solid thin black;
padding: 1em;
background: rgb(240,240,240);
color: black;
z-index: 300;
overflow: auto;
display: block;
visibility: visible;
}
div.toc-heading {
width: 100%;
border-bottom: solid 1px rgb(180,180,180);
margin-bottom: 1em;
text-align: center;
}
pre {
font-size: 120%;
font-weight: bold;
line-height: 140%;
padding-top: 0.2em;
padding-bottom: 0.2em;
padding-left: 1em;
padding-right: 1em;
/*
border-style: solid;
border-left-width: 1em;
border-top-width: thin;
border-right-width: thin;
border-bottom-width: thin;
border-color: #95ABD0;
*/
color: #0F398D;
background-color: #fff8f8;
}
@media print {
div.slide {
display: block;
visibility: visible;
position: relative;
border-top-style: solid;
border-top-width: thin;
border-top-color: black;
}
div.slide pre { font-size: 60%; padding-left: 0.5em; }
div.handout { display: block; visibility: visible; }
}
blockquote { font-style: italic }
img { background-color: transparent }
p.copyright { font-size: smaller }
.center { text-align: center }
.footnote { font-size: smaller; margin-left: 2em; }
a img { border-width: 0; border-style: none }
a:visited { color: navy }
a:link { color: navy }
a:hover { color: red; text-decoration: underline }
a:active { color: red; text-decoration: underline }
a {text-decoration: none}
.navbar a:link {color: white}
.navbar a:visited {color: yellow}
.navbar a:active {color: red}
.navbar a:hover {color: red}
ul { list-style-type: square; }
ul ul { list-style-type: disc; }
ul ul ul { list-style-type: circle; }
ul ul ul ul { list-style-type: disc; }
li { margin-left: 2em; margin-top: 0.5em; }
li li { font-size: 85%; font-style: italic }
li li li { font-size: 85%; font-style: normal }
div dt
{
margin-left: 0;
margin-top: 1em;
margin-bottom: 0.5em;
font-weight: bold;
}
div dd
{
margin-left: 2em;
margin-bottom: 0.5em;
}
p,pre,ul,ol,blockquote,h2,h3,h4,h5,h6,dl,table {
margin-left: 1em;
margin-right: 1em;
}
p.subhead { font-weight: bold; margin-top: 2em; }
p.smaller { font-size: smaller }
td,th { padding: 0.2em }
ul {
margin: 0.5em 1.5em 0.5em 1.5em;
padding: 0;
}
ol {
margin: 0.5em 1.5em 0.5em 1.5em;
padding: 0;
}
ul { list-style-type: square; }
ul ul { list-style-type: disc; }
ul ul ul { list-style-type: circle; }
ul ul ul ul { list-style-type: disc; }
ul li {
list-style: square;
//margin: 0.1em 0em 0.6em 0;
padding: 0 0 0 0;
line-height: 140%;
}
ol li {
margin: 0.1em 0em 0.6em 1.5em;
padding: 0 0 0 0px;
line-height: 140%;
list-style-type: decimal;
}
li ul li {
font-size: 85%;
font-style: italic;
list-style-type: disc;
background: transparent;
padding: 0 0 0 0;
}
li li ul li {
font-size: 85%;
font-style: normal;
list-style-type: circle;
background: transparent;
padding: 0 0 0 0;
}
li li li ul li {
list-style-type: disc;
background: transparent;
padding: 0 0 0 0;
}
li ol li {
list-style-type: decimal;
}
li li ol li {
list-style-type: decimal;
}
/*
setting class="outline on ol or ul makes it behave as an
ouline list where blocklevel content in li elements is
hidden by default and can be expanded or collapsed with
mouse click. Set class="expand" on li to override default
*/
ol.outline li:hover { cursor: pointer }
ol.outline li.nofold:hover { cursor: default }
ul.outline li:hover { cursor: pointer }
ul.outline li.nofold:hover { cursor: default }
ol.outline { list-style:decimal; }
ol.outline ol { list-style-type:lower-alpha }
/* for slides with class "title" in table of contents */
a.titleslide { font-weight: bold; font-style: italic }
This diff is collapsed.
......@@ -83,7 +83,7 @@
<li><a href="/doc/effective_go.html">Effective Go</a></li>
<li><a href="/doc/go_faq.html">FAQ</a></li>
<li><a href="/doc/go_lang_faq.html">Language Design FAQ</a></li>
<li><a href="http://www.youtube.com/watch?v=rKnDgT73v8s">Tech talk (1 hour)</a> (<a href="/doc/go_talk-20091030.pdf">PDF</a>)</li>
<li><a href="http://www.youtube.com/watch?v=rKnDgT73v8s">Tech talk (1 hour)</a> (<a href="/doc/talks/go_talk-20091030.pdf">PDF</a>)</li>
<li><a href="/doc/go_spec.html">Language Specification</a></li>
<li><a href="/doc/go_mem.html">Memory Model</a></li>
<li><a href="/doc/go_for_cpp_programmers.html">Go for C++ Programmers</a></li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment