
Chris Lattner on Swift - tambourine_man
http://nondot.org/sabre/
======
Arjuna
Chris demonstrated Swift and Playgrounds at WWDC 2014:

 _" I can build anything with Swift... from a social media application, all
the way up to a high-performance, 3D game using Metal."_

[https://www.youtube.com/watch?v=nKMAV6owYh4#t=6436](https://www.youtube.com/watch?v=nKMAV6owYh4#t=6436)

He wrote this chapter (entitled _LLVM_ ) in the book, "The Architecture of
Open Source Applications":

[http://aosabook.org/en/llvm.html](http://aosabook.org/en/llvm.html)

* * *

On the general topic, I wrote this [1] a little earlier in another thread; I'm
just impressed with how Apple is becoming a gaming powerhouse.

[1]
[https://news.ycombinator.com/item?id=7841744](https://news.ycombinator.com/item?id=7841744)

~~~
diminish
Did he mention anywhere Swift will be open sourced, the way LLVM has been? If
not, why?

~~~
dikei
Does it really matter ? While I think Swift is an amazing language, it would
be much less useful outside the closed ecosystem of Apple. The same thing
happened to C#, it never really took off outside Windows.

~~~
Shebanator
C# is extremely popular in the gaming industry.

~~~
EpicEng
A small sector perhaps, but it isn't that popular if you look at the entire
industry, i.e., AAA games. No one is writing CoD or Witcher in C#.

~~~
Vetre
I respectfully disagree. You can't downplay the massive indie game libraries
or even AA games out there. They're not breaking records, but they make a
large amount of sales.

There are several massive communities that use Monogame (even still use XNA)
and Unity. It's huge in the indie community, and is basically how the XB1,
PS4, and Vita expect you to make games for their systems. The Vita Tool Chain
is mostly C#.

Sure, no one is writing AAA games that require maximum graphical capabilities
in C#, those teams use C++ exclusively (often with a scripting language on
top). At that point that is really the only language AAA games use if they are
made from scratch, otherwise they are using an engine already made in C++.

Bastion, Magika, A.R.E.S., Dust, Fez, Rogue Legacy, Reus, and Terraria are
just a few made in XNA/Mono. And looking at total sales amounts, some of those
games definitely had revenues over a million dollars.

That's not including unity games like: Shadowrun Returns, Rust, Wasteland 2,
and Hearth Stone. These games made very good amounts of money, again, not 100%
AAA, but still industry veterans.

~~~
EpicEng
I suppose you're right, I shouldn't have downplayed them. I just think you
need to segregate the two groups as they are almost completely different
industries. To say that "C# is really popular in the video game industry" is
misleading.

~~~
Vetre
I can mostly see your argument. It makes sense. The indie and AAA industry are
two different beasts, but they are the same industry.

It feels like one of those big business vs small business issues. If you have
the man power and the resources, you can go much farther much faster. But not
every starting company can afford the overhead of going full C++ and Engine
heavy.

So C# being 'really' popular in the AAA side of the industry is a tad
misleading (though can be used as a language on top of the engine, for tools
(where it is probably most used), and for tool-chain), to discount it only due
to the top 33% of companies usage, is a bit unfair to the quite large and
growing indie and AA crowd.

------
slaven
It's amazing that Apple managed to go from hatching the idea in mid-2010 to
releasing a fully working framework 4 years later, with tight IDE integration,
huge amount of testing and compatibility without a single leak (that I've
heard of).

~~~
gilgoomesh
The existence of a programming language named Swift under internal development
at Apple had leaked. What it was for wasn't clear – it certainly wasn't clear
that it would replace Objective-C.

~~~
kgarten
can you give a reference?

------
siavosh
Great to see the credit to Bret Victor and Chris Granger's Light Table.
Apple's resources can really help move forward these new ideas of what an IDE
can be. If Swift is successful, a whole generation of young developers will
use and improve on these ideas. Very exciting to see what happens.

~~~
seanmcdirmid
Why do Bret V and Chris G get all the credit for something invented in the
90s? E.g. Steering programs with time travel
([http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.33....](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.33.538&rep=rep1&type=pdf)).

~~~
gress
Because they made some impressive demos to reintroduce the concepts at a time
when the audience is ready for them.

~~~
seanmcdirmid
Fine, but if this guy was just inspired by and knew about LightTable and
Bret's demos, he is missing a lot of good ideas and experiences that have been
gathered over the last 30 years in doing similar things. They are destined to
relearn the past.

~~~
gress
I agree, and frankly I think Bret Victor in particular hasn't until recently
referenced his influences enough.

------
scotu
He does not have a beard. I'm very skeptic this language will be successful

~~~
cbrauchli
I think the beard test is for OS developers.

~~~
phaedryx
Matz with a beard: [http://www.rubyist.net/~matz/images/matz-
beard.jpg](http://www.rubyist.net/~matz/images/matz-beard.jpg)

He grew it specifically as a response to the "beard test" for programming
languages.

~~~
DerekL
Macintosh- and facial-hair-related:
[http://www.folklore.org/StoryView.py?story=Moustache.txt](http://www.folklore.org/StoryView.py?story=Moustache.txt)

------
gw
It is nice that he mentioned Light Table. I would not be surprised if Swift
ends up really benefitting Clojure adoption indirectly. I think one of the big
hangups for newcomers is that, if you don't have experience with a Lisp, it's
often difficult to understand the benefits of interactive development. If a
large amount of new programmers become exposed to it, they'll be more open to
other options that provide similar or better interactivity.

~~~
ibdknox
The only thing that makes me sad is that because of their focus on secrecy,
they're doomed to relearn all that we learned along the way. Having played
with the swift playground stuff, just an hour long conversation could've made
a big difference.

Such is the way of Apple though.

~~~
bsdetector
On the other hand by keeping it secret and internal they avoided making bad
decisions due to defensiveness and stubbornness.

An example of this is Go; they don't actually take input from outsiders
(generics) and when they have had to give in to outside ideas they implement
it poorly just to be different (exceptions as panic). They would rather people
put in a no-op printf to avoid the unused package error rather than letting it
be a warning because of their own self-righteousness.

Apple's secretive process may not be ideal, but there are far worse processes
out there.

~~~
enneff
Wow, I'm not sure how to begin responding to that.

Go has taken a lot of suggestions from the open source community. Check the Go
1 mailing list discussions for examples. But panic existed before the
opensource release and is not a substitute for exceptions, and nobody has
actually proposed a viable generics implementation. The unused
variable/package thing is a fundamental to the project's goals of working well
at scale, and tools like goimports alleviate the pain (sometimes the answer is
tools, not language changes).

Overall I'm pretty dismayed by your characterisation of Go as an open source
project. We have a lot of great contributors from outside Google and your
ignorant comments do them a great disservice.

~~~
bsdetector
I realize I'm in the Lion's Den. I feel that if you stepped outside the Google
employee and Hacker News bubble you would see Go stubbornly refusing to have
modern features, as I do.

I've been programming for 30 years and have written code that is in every
Linux distro, and yes I did read the Go mailing list occasionally in the early
days. But if it makes you feel better to call my opinions ignorant then I hope
that's working out for you.

~~~
jbarham
> I've been programming for 30 years and have written code that is in every
> Linux distro

A very strange argument from authority considering Ken Thompson is one of Go's
designers...

Considering the fact that 700 people attended the inaugural Go conference, and
the variety of speakers
([http://gophercon.com/schedule/](http://gophercon.com/schedule/)), I think
it's safe to say that Go has gained traction far beyond the Google employee
and HN "bubbles".

~~~
bsdetector
The argument of authority of Go designers is actually my point. By designing
the language in public (even before having source available) they now don't
want to admit their errors, and neither do their supporters, because they are
authorities, supposedly. I'm thinking of Pike in particular.

By keeping these discussions private, the Apple team did not need to protect
their egos or their authority. We do not know who is responsible for which
decisions at which points in the design, and they don't feel the need to
defend their choices in public.

~~~
dsymonds
The Go team has admitted several errors publicly (e.g. var binding for range
loops, some standard library design) on multiple occasions. Those errors won't
be changed because we consider preserving backward compatibility more
important. You could say that holding on to backward compatibility is
"defensiveness and stubbornness", but it's really just making a different
decision to what you may have done in the same situation.

In fact, your premise is almost entirely incorrect. Probably 95% of Go's
language design happened before it was open sourced, so it's in exactly the
same situation as Swift. The Go language hasn't changed a lot since November
2009.

------
jayvanguard
It looks like Rust was a major influence. It has been interesting seeing all
these posts claiming Swift borrowed from _their_ language.

Obviously there is a lot of feature influence between languages but it was
interesting to see the ones he called out explicitly.

~~~
pohl
It's a bit of a Rorschach test, sometimes. People see what's familiar to them.

~~~
sekasi
Great way of putting it. I see Ruby in it personally, and loads and loads of
C#, but I have heard the Rust thing before from other people.

------
kinofcain
His take on the "x years of swift experience" meme is pretty great:

 _" Looking forward to next month: I'll be the first and only guy with 4 years
of swift programming experience :-)"_

[https://mobile.twitter.com/clattner_llvm/status/473835365137...](https://mobile.twitter.com/clattner_llvm/status/473835365137416192)

------
prezjordan
> I hope that by making programming more approachable and fun, we'll appeal to
> the next generation of programmers and to help redefine how Computer Science
> is taught.

I'll be cynical here: can this be done if the language ends up being
restricted to apple devices?

~~~
bsaul
To me, this is going to be the only thing that matters : dill this language be
used for non-apple platform coding. I've been looking for a language just like
that for a very long time on the server side for example.

------
niix
Really excited for Swift. I've tried and failed many times to learn Objective
C and felt that the barrier to entry was a bit to high for myself. As a
someone who writes JavaScript for a living, Swift is very inviting.

~~~
Cookingboy
Not trying to be rude, but if you've tried and actually FAILED to learn
Objective-C multiple times, then you will have a much bigger problem with
actually learning the Cocoa framework yourself. Objective-C does have a non-
standard syntax, but its barrier of entry for actual learning is purely
psychological and not technical.

~~~
m_mueller
Maybe the mistake could lie in starting with Objective C without first
learning C? I'm thinking that a reasonably solid C foundation helps a lot in
understanding why and how Obj-C works.

~~~
sjwright
I went straight from a CFML/Java/Javascript web developer to picking up
Objective C in a week. I had some coaching from a C/C++ expert, who learned
ObjC on the fly and wrote a first draft of an app I designed, but from there I
worked out how to solve my own problems and eventually became a moderately
high skilled ObjC developer.

I have subsequently leveraged that ObjC experience to become somewhat
proficient in plain C, a skill I appreciate today and something I might never
have learned otherwise.

------
kyle_t
Site seems to be buckling under load. Google cache:
[http://webcache.googleusercontent.com/search?q=cache:http://...](http://webcache.googleusercontent.com/search?q=cache:http://nondot.org/sabre/)

~~~
henryw
Here's a screenshot of the page
[http://i.imgur.com/C51LXnz.png](http://i.imgur.com/C51LXnz.png)

------
jiaweihli
I'm not sure if it's XCode / playground acting up, but array equality is
broken for me: `[1, 2, 3] == [1, 2, 3]` returns false. This seems to
contradict the core declarations though:

/// Returns true if these arrays contain the same elements.

func ==<T : Equatable>(lhs: T[], rhs: T[]) -> Bool

Works alright for dictionaries. Is there a bug tracker for Swift anywhere to
report this?

Edit:

Whoops, copied wrong declaration. ContiguousArrays actually work fine, but
require an extra cast. e.g.

ContiguousArray([1, 2, 3]) == ContiguousArray([1, 2, 3])

~~~
lcnmrn
var one = [1, 2, 3]

var two = [1, 2, 3]

one == two

That's because Swift checks for safety first (variable declaration).

~~~
jiaweihli
Can you explain what you mean by `checks for safety first (variable
declaration)`?

This issue only seems to affect arrays. Strings, numbers, and dictionaries are
fine.

------
spike021
Another interesting thing to note is that because Swift really began in
roughly mid-2010, Steve Jobs probably had his hand at least slightly in it
(obviously not as a programmer).

I guess my point being that there was likely some more specific reason for why
it gained momentum later.

~~~
thinkpad20
I dunno, it's possible but OTOH it's hard to imagine a guy like Steve Jobs,
for whom (as far as I know) coding wasn't a primary concern, and who was
dealing with cancer and much bigger fish in the i* products, being any more
than tangentially involved in what would have been at the time a fledgling
research language project. He was probably aware that it was happening, but I
doubt that he played much of a role. Apple is after all a massive company
filled with many smart people and who knows how many research projects.

~~~
grecy
I think it very likely Apple have all kinds of 1, 2, 5 and 10 year road maps
for all their products (software and hardware).

Given that almost all of them rely so heavily on Objective-C, I expect they've
had a road map for that (and XCode and the whole tool chain) for a very long
time.

Given the plan is now to phase out ObjC and replace it entirely with Swift, I
think it's extremely unlikely Steve didn't know about it, and endorse it.

~~~
Alphasite_
He did say that it wasn't A major Apple focus until last year, when they
actually got together and did all the end work.

~~~
grecy
It might not have been a major focus until last year, but I'll bet it was on
road maps for many, many years preceding that.

------
fataliss
I feel like swift is really a good view on the future of programming. And it
seems that in the future we have really two different kind of software
engineers. As we make programming mainstream and easy, we will see some new
people able to use langages like swift and dev good apps without having the
slightest idea of what is happening underneath. We used to have at least a
common background between software engineers but I think it gonna slowly
disappear. Is it good or bad? I can't make up my mind yet, but I'm really
considering more and more to go back to lower level langages as I feel like
the upper levels are going to be crowded by young generations.

~~~
JoeAltmaier
"Underneath" just means "the level below where I'm writing". This has pretty
much always been true, the way systems are layered. You write install scripts?
Apps? Libraries? rendering engines? Drivers? OS? Firmware? Chip layout? You
probably don't really know what goes on 'underneath' your layer.

~~~
fataliss
I agree but I feel like with swift it's kinda reaching an extent and it really
doesn't push you toward learning any other layer. Swift + playground feels
like the new dreamweaver to me. Either people are gonna write ugly code that
shows them what they want to do or keep building quality apps, I don't know, I
guess future will tell us. But I guess my main point was just that where I
personally would try to reduce the gap between the different layers so we
developers know what happens from A to Z (at least on the software side), the
industry is clearly adding layer on layers such a way it's nearly impossible
to control and understand the whole thing.

~~~
ben336
Our entire software industry is built on the power of abstractions. While its
always great to know as much as you can about the layers you are building on,
solid abstractions that allow you to get away with NOT knowing that unless you
want to or need to optimize to extremes are a great thing.

------
steele
I can't afford to ignore it as it matures, but with my dev setup right now, I
just can't afford it. Hoping to see this work well in Linux and Windows.

~~~
oliyoung
XCode6 runs alongside XCode5, you can safely play with Playground and build
apps in the simulator, and even install iOS8 on a dev device and deploy there,
without affecting your toolchain

------
thehme
Swift "greatly benefited from the experiences hard-won by many other languages
in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#,
CLU, and far too many others to list." I have been wondering if in fact this
language will be Open Source, since it is said to have taken from other
programming languages, some of which are Open Source, yet the decision to make
it Open Source has not been made? Lock down.

~~~
rsynnott
In general, a _language_ is not open source; its _implementation_ is.

~~~
thehme
Right, well, let's see what happens. I kindda agree with Gordon Haff
([http://www.cnet.com/news/apples-new-swift-coding-language-
ho...](http://www.cnet.com/news/apples-new-swift-coding-language-hopes-to-
lock-down-errors/)) on being disappointed that Apple did choose a more open
platform, but I suppose this can change in time, like with Microsoft recent
changes.

------
thibautx
Extremely excited about this language's versatility. Also great to see the
work of my school's Alumni and professors going into production. This is the
third time I've come across the LLVM compiler in industry use (albeit nothing
to the scale of iOS' language) - anecdotally during my internship search this
last semester. Will be very interesting to take Professor Adve's compiler
course soon.

------
herinkc
Apple really took a big step. Waiting to see amazing stuffs done with Swift.

------
LeicaLatte
Looking forwards, here's a dream roadmap if this WWDC is any indication.

playgrounds for iPad, interface builder for iPad and finally Xcode.

------
airjd
I like js, but not swift.

------
c2u
Swift is a little complex.

Does it compile to Object-C?

~~~
pohl
No, it compiles from source to LLVM IR to native instructions, just like with
clang or rustc

------
mzs
I wish Apple had selected a different name:
[https://www.ci.uchicago.edu/research-
projects/swift](https://www.ci.uchicago.edu/research-projects/swift)

~~~
afternooner
Name a letter or a word and there is some project out there that had it
before. If you come to grips with this now, your adult life will be much
easier.

------
dominiek23
Funny how he forgot to mention Golang somehow while that seems to be one of
the bigger inspirations for the language.

~~~
necubi
I don't understand why people keep comparing Swift and Go, as they have
diametrically opposed philosophies. As stated succinctly by Bryan O'Sullivan
(one of the most prominent people in the Haskell community) on Twitter:

"It's interesting to compare Swift and Go. One has caught up to the 1990s in
language design, with the other firmly in the 60s."

Swift includes many of the language features that have been touted by the
academic functional programming community for years but which have not made a
large impact in industry, like algebraic data types, pattern matching, and
Optionals. The designers of Go apparently looked at the past few decades of
language research and decided that none of it interested them. The only really
innovative parts of Go are its concurrency support, which Swift seems to be
completely lacking.

~~~
personZ
_The only really innovative parts of Go are its concurrency support, which
Swift seems to be completely lacking._

Worth noting that one of the greatest problems in software development is
concurrency support and its ease of use/robustness.

It is a critical and growing issue.

In contrast, having or not having generics, optionals (in C# these are
nullable types), algebraic data types (which in Go is interface, albiet minus
the type set checking) make a marginal, vanishingly small difference in
programmer productivity or application performance/stability.

99% of the articles about the profound importance of generics are people
building nothing of interest for anyone, and it is exactly that vaguery of
design that makes generics seem so important.

Concurrency, however, is everyone's problem. It is _the_ modern programming
problem. Nothing is more important.

And FWIW, all languages draw from each other, and of course they should learn
from each other. It is very likely that Go influenced Swift in subtle ways,
but it is obvious why that wouldn't be referenced.

~~~
coob
Genuine question: what does Go provide in terms of concurrency that Swift +
GCD doesn't?

~~~
Glide
I would argue that Go has it more "baked in."

But I'm actually curious as well. Given that Objective-C (and now Swift) have
GCD, what language features are needed to bring concurrency up to par with Go?

I'm sort of reminded of what Microsoft did after Task Parallel Library came
out with C#. People didn't pay attention too much to what MS was building
until async/await came out (along with tooling support). But async/await built
upon TPL. So it's probably a matter of time for Apple to do something similar
on top of GCD, if they're going to do something. But I doubt it's going to
look something like Go.

------
enraged_camel
I like Chris and what he has done, but...

>>The Swift language is the product of tireless effort from a team of language
experts, documentation gurus, compiler optimization ninjas...

Seriously? What is a "documentation guru"? What is a "compiler optimization
ninja"? I find language like this so distracting and asinine that I had to
stop reading. Am I the only one?

~~~
glibgil
Yes, you are the only one. Replace "guru" with "expert" and "ninja" with
"expert" and continue reading. There are already no real ninjas in the world
and soon there will be no real gurus. No one thinks twice when someone is
called a marketing wiz (there are no real wizards any more). Language changes
and metaphors using archaic terms are commonly introduced.

~~~
enraged_camel
That's funny, because when such language is used in job postings, they are
overwhelmingly frowned upon by HN folks. But I guess it's OK when someone like
Chris does it...

edit: judging by the downvotes, he seems to have a lot of fans. :)

~~~
bronson
Likely downvoted because this is the stupidest, most pointless comment thread
on an otherwise decent page. Contributing to it is what's overwhelmingly
frowned upon by HN.

(Yes, I know. I could use some downvotes.)

