Chris Lattner: The Future of Computing and Programming Languages | Lex Fridman Podcast #131
nWTvXbQHwWs • 2020-10-19
Transcript preview
Open
Kind: captions
Language: en
the following is a conversation with
Chris lner his second time in the
podcast he's one of the most brilliant
engineers in modern Computing having
created llvm compiler infrastructure
project the clang compiler the Swift
programming language a lot of key
contributions to tensor flown tpus as
part of Google he served as vice
president of autopilot software Tesla
was a software innovator and leader at
Apple and now is at SciFi as senior vice
president of platform engineering
looking to revolutionize chip design to
make it faster better and cheaper quick
mention of each sponsor followed by some
thoughts related to the episode first
sponsor is blinkist an app that
summarizes key ideas from thousands of
books I use it almost every day to learn
new things or to pick which books I want
to read or listen to next second is
neuro the maker of functional sugar-free
gum and mints that I use to supercharge
my mind with caffeine alanine and B
vitamins third is master class online
courses from the best people in the
world on each of the topics covered from
Rockets to game design to Poker to
writing and to guitar and finally cash
app the app I use to send money to
friends for food drinks and
unfortunately lost bets please check out
the sponsors in the description to get a
discount and to support this podcast as
a side note let me say that Chris has
been in inspiration to me on a human
level because he is so damn good as an
engineer and leader of Engineers and yet
he's able to stay humble especially
humble enough to hear the voices of
disagreement and to learn from them he
was supportive of me in this podcast
from the early days and for that I'm
forever grateful to be honest most of my
life no one really believed that I would
amount to much so when another human
being looks at me and makes me feel like
I might be someone special it can be
truly inspired ing that's a lesson for
educators the weird kid in the corner
with a dream is someone who might need
your love and support in order for that
dream to
flourish if you enjoy this thing
subscribe on YouTube review it with five
stars and apple podcast follow on
Spotify support on patreon or connect
with me on Twitter at Lex Freedman and
now here's my conversation with Chris
lner what are the strongest qualities of
Steve Jobs Elon Musk and the Great and
Powerful Jeff Dean since you've gotten
the chance to work with each you're
starting with an easy question there um
these are three very different people I
guess you could do maybe a pair wise
comparison between them instead of a
group comparison so if you look at Steve
Jobs and Elon um I worked a lot more
with Elon than I did with Steve um they
have a lot of commonality they're both
um Visionary in their own way they're
both very demanding in their own way um
my sense is Steve Steve is much more
human factor focused where Elon is more
technology focused what does human
factor mean Steve is trying to build
things that feel good that people love
that affect people's lives how they live
he's looking into into the future a
little bit in terms of um what people
want um where I think the Elon focuses
more on uh learning how exponentials
work and predicting the development of
those Steve worked with a lot of
Engineers that was one of the things
that reading the biography and how how
can a designer essentially talk to
engineers and like get their respect I
think so I did not work very closely
with Steve I'm not an expert at all my
sense is that he uh pushed people really
hard but then when he got an explanation
that made sense to him then he would let
go and um he did actually have a lot of
respect for engineering and but he also
knew when to push and you know when you
can read people well you can know when
they're holding back and when you can
get a little bit more out of them and I
think he was very good at that I mean if
you if you compare the other the other
folks so Jeff Dean right Jeff Dean's an
amazing guy he's super smart um as as
are the other guys um Jeff is a really
really really nice guy well-meaning he's
a classic googler he uh uh wants people
to be happy he combines it with
Brilliance so he can pull people
together in a in a really great way he's
definitely not a CEO type I don't think
he would even want to be that um do you
know if he still programs oh yeah
definitely programs Jeff is an amazing
engineer today right and that has never
changed so um it's really hard to
compare Jeff to to either of those two
um he uh I think that Jeff leads through
technology and building it himself and
then pulling people in and inspiring
them and so I think that that's um a one
of the amazing things about Jeff but
each of these people you know with their
pros and cons all are really
inspirational and have achieved amazing
things so it's been a it's been I've
been very fortunate to work with these
guys for yourself you've LED large teams
you've done so many incredible difficult
technical challenges is there something
you've picked up from them about how to
lead yeah well so I mean I think
leadership is really hard it really
depends on what you're looking for there
um I think you really need to know what
you're talking about so being grounded
on the product on the technology on the
business on the mission is really
important being uh understanding what
people are looking for for why they're
there one of the most amazing things
about Tesla is the unifying Vision right
people are there because they believe in
clean energy and El electrification all
these kinds of things um uh the others
is to understand what really motivates
people how to get the best people how to
how to build a plan that actually can be
executed right there's so many different
aspects of leadership and it really
depends on the time the place the
problems you know you know there's a lot
of issues that don't need to be solved
and so if you focus on the right things
and prioritize well that can really help
move things two interesting things you
mentioned one is you really have to know
what you're talking about how you've
uh you've worked on a lot of very
challenging technical things sure
so I kind of assume you were born uh
technically Savvy but assuming that's
not the case uh how did how did you
develop technical expertise like even at
Google you worked on I don't know how
many projects but really challenging
very varied compilers tpus Hardware
Cloud stuff bunch of different things um
the thing that I've become comfortable
as I've more comfortable with as I've uh
gained experience is uh being okay with
not knowing and so a major part of
leadership is actually it's not about
having the right answer it's about
getting the right answer and so if
you're working in a team of amazing
people right and many of these places
many of these companies all have amazing
people it's the question of how do you
get people together how do you get how
do you build trust how do you get people
to open up how do you people get people
to you know be vulnerable sometimes with
an idea that maybe isn't good enough but
it's the start of something beautiful
how do you um how do you provide an
environment where you're not just like
top down Thou shalt do the thing that I
tell you to do right but you're
encouraging people to be part of the
solution and uh and providing a safe
space where if you're not doing the
right thing they're willing to tell you
about it right so you're okay asking
dumb questions yeah dumb questions are
my specialty yeah well I so I've been in
the hardware room recently and I don't
know much at all about how chips are
designed I know a lot about using them I
know some of the principles and the ARs
technical level of this but level it
turns out that if you ask a lot of dumb
questions you get smarter really really
quick and when you're surrounded by
people that want to teach and learn
themselves uh it can be a beautiful
thing uh so let's talk about programming
languages if it's okay at the High this
absurd philosophical level cuz I I don't
get romantic on me Lex I I will forever
get
romantic and uh Tor here I apologize uh
why do programming languages even
matter okay well thank you very much so
you're saying why should why why should
you care about anyone programming
language or why do why do we care about
programming computers or no why why do
we why do we care about programming
language design creating effective
programming
languages uh
choosing a you know one programming
languages versus another programming
language why we keep struggling and
improving through the evolution of these
programming languages sure sure sure
okay so so I mean I think you have to
come back to what what are we trying to
do here right so we have these these uh
beasts called computers that are very
good at specific kinds of things and we
think it's useful to have them do it for
us right uh now you have this question
of how best to express that because you
have a human brain still that has an
idea in its head and you want to achieve
something right so well there's lots of
ways of doing this you can go directly
to the machine and speak Assembly
Language and then you can express
directly what the computer understands
that's fine um you can then have higher
and higher and higher levels of
exraction up until machine learning and
you're designing an neural net to do the
work for you um the question is where
where along this way do you want to stop
and what benefits do you get out of
doing so and so programming languages in
general you have C you have Fortran and
Java and a Pascal Swift you have lots of
different things um they all have
different trade-offs and they're T
tackling different parts of the problems
now one of the things that most
programming languages do is they're
trying to make it so that you have
pretty basic things like portability
across different Hardware so you've got
I'm going to run on an Intel PC I'm
going to run on RIS 5 PC I'm going to
run on a arm phone or something like
that fine um I want to write one program
and have it portable and this is
something the assembly doesn't do now
when you start looking at the space of
programming languages this is where I
think it's fun
because programming languages all have
trade-offs and most people will walk up
to them and they look at the surface
level of syntax and say oh I like Curly
braces or I like tabs or I like you know
semicolons or not or whatever right
subjective fairly subjective very
shallow things but programming languages
when done right can actually be very
powerful and the the benefit they bring
is expression
okay and if you look at programming
languages there's really kind of two
different levels to them one is the down
in the dirt nuts and bolts of how do you
get the computer to be efficient stuff
like that how they work type systems
compiler stuff things like that the
other is the UI and the UI for
programming language is really a design
problem and a lot of people don't think
about it that way and the UI you mean
all that stuff with the braces and yeah
all that stuff to the UI and what it is
and UI means user interface um and so
what what's really going on is it's the
interface between the guts and the human
and humans are hard right humans have
feelings they have things they like they
have things they don't like and a lot of
people treat programming languages as
though humans are just kind of abstract
creatures that cannot be predicted but
it turns out that actually there are
there is better and
worse like people can tell when a
program language is good or when it was
an accident right and uh one of the
things with Swift in particular is that
a tremendous amount of time by a t
tremendous number of people have been
put into really polishing and Mak it
feel good but it also has really good
nuts and bolts underneath it you said
that uh Swift makes a lot of people feel
good how do you get to that
point
so how do you predict that um you know
tens of thousands hundreds of thousands
of people are going to enjoy using this
the user experience of this programming
language well you can you can look at it
in terms of better and worse right so if
you have to write lots of boiler plate
or something like that you will feel
unproductive and so that's a bad thing
you can look at it in terms of safety if
like C for example is what's called a
memory unsafe language and so you get
dangling pointers and you get all these
kind of bugs that then you have to spend
tons of time debugging and it's a real
pain in the butt and you feel
unproductive and so by subtracting these
things from the experience you get um
you know happier people but uh uh again
keep interrupting I'm sorry uh but so
hard to deal
with if you look at the people people
that are most productive on stack
Overflow they are uh they have a set of
priorities yeah that may not always
correlate perfectly with the experience
of the majority of users you know like
if you look at the most uploaded uh
quote unquote correct answer on stack
Overflow it
usually really um sort of uh prioritizes
like safe code proper code stable
code uh you know that kind of stuff as
opposed to like if I want to use go-to
statements in my basic right uh I'm I
want to use go-to State like what if 99%
of people want to use go-to statements
or use completely improper you know
unsafe syntax I I don't think that
people actually like if you boil it down
and you get below the surface level
people don't actually care about go-tos
or if statements for things like this
they care about achieving a goal yeah
right so the real question is I want to
set up a web server and I want to do a
thing and I whatever like how how
quickly can I achieve that right and so
the from a programming language
perspective there's really two things
that that matter there one is what
libraries exist and then how quickly can
you put it together and what are the
tools around that look like right and uh
and when you want to build a library
that's missing what do you do okay now
this is where you see huge Divergence in
the force between worlds okay and so you
look at python for example python is
really good at assembling things but
it's not so great at building all the
libraries and so what you get because of
performance reasons other things like
this is you get python layered on top of
C MH for example and that means that
doing certain kinds of things well it
doesn't really make sense to do in
Python instead you do it in C and then
you rapid and then you have you're
living in Two Worlds and Two Worlds
never is really great because tooling
and the the debugger doesn't work right
and like all these kinds of things can
you clarify a little bit what uh what
you mean by python is not good at
building libraries meaning doesn't make
certain kinds of libraries no but just
the actual meaning of the sentence yeah
uh meaning like it's not conducive to
developers to come in and add libraries
or it's it's or the langu or is it the
The Duality of the it's a dance between
Python and c and Python's amazing
Python's a great language I did not mean
to say that python is is bad for
libraries what what I meant to say is um
there python there are libraries that
Python's really good at they you can
write in Python but there are other
things like if you want to build a
machine learning framework you're not
going to build a machine learning
framework in Python because of
performance for example or you want GPU
acceleration or things like this instead
what you do is you write a bunch of C or
C++ code or something like that and then
you talk to it from python right and so
this is because of decisions that were
made in the python design and um and
those decisions have other
counterbalancing forces but but the
trick when you start looking at this
from a programming language perspective
is you start say okay cool how do I
build this catalog of libraries that are
really powerful and how do I make it so
that then they can be assembled into
ways that feel good and they generally
work the first time because when you're
talking about building a thing you have
to include the debugging the fixing the
turnaround cycle the development cycle
all that kind of stuff in in into the
process of building the thing it's not
just about pounding out the code and so
this is where things like um you know
catching bugs at compile time is
valuable for example um but if you dive
into the details on this Swift for
example has certain things like value
semantics which is this fancy way of
saying that when you uh treat a treat a
variable like a value um uh it acts like
a mathematical object would okay so in
you have used pytorch a little bit in
pytorch you have tensors tensors are uh
ND nend dimensional grid of numbers very
simple you can do plus and other
operators on them it's all totally fine
but why do you need to clone a tensor
sometimes have you ever run into that uh
yeah okay and so why is that why do you
need to clone a tensor it's the usual
object thing that's in Python so in
Python and just like with Java and many
other languages this isn't unique to
python in Python it has a thing called
reference semantics which is the nerdy
way of explaining this and what that
means is you actually have a pointer to
a thing instead of the thing okay now
this is due to a bunch of implementation
details that you don't want to go into
but in Swift you have this thing called
value sematics and so when you have a
tensor in Swift it is a value if you
copy it it looks like you have a unique
copy and if you go change one of those
copies then uh it doesn't update the
other one because you just made a copy
of this thing right so that that's like
highly error prone in uh at least
computer science math Centric
disciplines about python that like the
the thing you would expect to behave
like math like math it doesn't behave
like math and in fact uh quietly doesn't
behave like math and then can ruin the
entirety of your math exactly well and
then it puts you in debugging land again
yeah right now now you just want to get
something done and you're like wait wait
a second where you need where do I need
to put clone in what level of this stack
which is very complicated which I
thought I was reusing somebody's library
and now I need to understand it to know
where to clone a thing thing right and
hard to debug by the way exactly right
and so this is where programming
languages really matter right so in
Swift having value sematics so that um
both you get the benefit of math working
like math right but also the efficiency
that comes with certain advantages there
certain implementation details there
really benefit you as a programmer right
you clarify the value sematics like how
how do you know that a thing should be
treated like a value yeah so so Swift uh
has a pretty strong culture and good
language support for defining values and
so if you have an array so tensors are
one example of that the machine learning
folks are very used to um just think
about arrays same thing where you have
an array you put uh you create an array
you put two or three or four things into
it and then you pass it off to another
function mhm what happens if that that
uh function adds some more things to it
well you'll see it on the side that you
pass it in right this is called
reference semantics now what if you
pass an array off to a function it
Scrolls it away in some dictionary or
some other data structure somewhere
right well it thought that you just
handed it that array then you return
back and that that that reference to
that array still exists in the callar
and they go and put more stuff in it
right the the person you handed it off
to may have thought they had the only
reference to that and so they didn't
know what they that this was going to
change underneath the covers and so this
is where you end up having to do clone
so like I was past a thing I'm not sure
if I have the only
version of it so now I have to clone it
so what value sematics does is it allows
you to say hey I have a so in Swift it
defaults to value sematics for oh so
defaults to value sematics and then
because most things should Valu then it
makes sense for that to be the default
and one of the important things about
that is that arrays and dictionaries and
all these other collections or
aggregations of other things also have
value semantics and so when you pass
this around uh to different parts of
your program you don't have to do these
defensive copies
and so this is this is great for two
sides right it's great because you
define away the bug which is a big deal
for productivity the the number one
thing most people care about but it's
also good for performance because when
you're doing a clone so you pass the
array down to the thing it's like I
don't know if anybody else has it I have
to clone it well you just did a copy of
a bunch of data it could be big and then
it could be that the thing that called
you is not keeping track of the old
thing so you just made a copy of it and
you may not have had to yeah and so the
way the value sematics work is in Swift
is it uses this thing called copy on
right which means that you get you get
the benefit of safety cool and
performance and it has another special
trick because um if you think of certain
languages like Java for example they
have immutable strings and so what
they're trying to do is they provide
value semantics by having pure
immutability functional languages have
pure immutability in lots of different
places and this provides a much safer
model than it provides
valics um the problem with this is if
you have immutability everything
everything is expensive everything
requires a copy um for example in Java
if you have a string X and A String y
you pen them together we have to
allocate a new string to hold XY oh if
they're immutable well and strings
strings in Java are immutable and if
there's there's optimizations for short
ones and it's it's complicated but but
generally uh think about them as a
separate allocation and so when you
append them together you have to go
allocate a third thing mhm because
somebody might have a pointer to either
of the other ones right and you can't go
change them so you have to go allocate a
third thing um because of the beauty of
how the Swift value SM system works out
if you have a string and Swift and you
say hey put in X right and they say
append on y z w what it knows that
there's only one reference to that and
so it can do an inpl
update and so you're not allocating tons
of stuff on the side you're not you
don't have all those problems when you
pass it off you can know you have the
only reference if you pass it off to
multiple different people but nobody
changes it they can all share the same
thing so you get a lot of the benefit of
of purely mutable design and so you get
a really nice sweet spot that I haven't
seen in other languages yeah that's like
I thought I thought there was going to
be a a philosophical like narrative here
that you're going to have to pay a cost
for it CU it sounds like uh I think
value semantics is beneficial for easing
of debugging or minim izing the risk of
Errors like bringing the errors closer
to the
source um bringing the symptom of the
air closer to the source of the air
however you say that and but you're
saying there's not a performance cost
either if you implement correctly well
so there there's trade-offs with
everything and so if you are doing very
low-level stuff then sometimes you can
noce cost but then what you're doing is
you're saying what is the right default
so um coming back to you interface when
you when you talk about programming
languages one of the ma ma major things
that Swift does that makes people love
it that is not obvious when it comes to
designing language is this UI principle
of progressive disclosure of complexity
okay so Swift like many languages is
very powerful the question is when do
you have to learn the power as a
user so Swift like python allows you to
start with like print hello world MH
right certain other languages uh start
with like public static void Main
like all the ceremony right and so you
go to teach you teach a new person hey W
welcome to this new thing let's talk
about Public Access Control classes wait
what's that string system.out do
printland like packages like God right
and so instead if you take this and you
say hey we need you need we need
packages you know modules we need we
need powerful things like classes we
need data structures we need like all
these things the question is how do you
factor after the complexity and how do
you make it so that the normal case
scenario is you're dealing with things
that work the right way the right way
give you good performance the right by
default but then as a power user if you
want to dive down to it you have full c
c performance full control over low-l
pointers you can call Malik if you want
to call Malik this is not recommended on
the first page of every tutorial but
it's actually really important when you
want to get work done right and so being
able to have that is really the design
in programm language design design and
design is really really hard it's
something that I think a lot of people
kind of um outside of UI again a lot of
people just think is uh subjective like
there's nothing you know it's just like
Curly braces or whatever it's just like
somebody's preference but actually good
design is something you can feel and uh
how many people are involved with good
design so if we looked at Swift but look
at historically I mean this might touch
like uh it's almost like a Steve jobs
question too like how much dictatorial
decision- making is required
versus um
collaborative and we'll talk about how
all that can go wrong or right but yeah
well Swift so I can't speak to in
general all design everywhere uh so the
way it works with swift is that um
there's a core team and so a core team
is uh six or seven people is something
like that that is people that have been
working with swift since very early days
and so I and by early days is not that
long ago okay yeah so it's it it became
public in 2014 so it's been six years
public now but um but still that's
enough time that there's a story arc
there okay and there's mistakes have
been made that then get fixed and you
learn something and then you you know
and so uh what the core team does is it
provides continuity and so you want to
have a okay well there's a big hole that
we want to fill we know we want to fill
it so don't do other things that invade
that space until we fill the hole right
there there's a boulder that's missing
here we want to do we will do that
Boulder even though it's not today keep
keep out of that space and the whole
team remembers of the remembers the myth
of the boulder that's there yeah yeah
there's a general sense of what the
future looks like in Broad strokes and a
shared understanding of that combined
with a shared understanding of what has
happened in the past that worked out
well and didn't work out well um the
next level out is you have the uh what's
called the Swift Evolution community and
you've got in that case hundreds of
people that really care passionately
about the way Swift evolves and that's
like an amazing thing to again uh the
court team doesn't necessarily need to
come up with all the good ideas you got
hundreds of people out there that care
about something and they come up with
really good ideas too and that provides
this like tumbling rock tumbler for
ideas and so the the evolution process
is you know a lot of people in a
discourse form they're like hashing it
out and trying to like talk about okay
well would should we go left or right or
if we did this what would be good and
you know here you're talking about
hundreds of people so you're not going
to get consensus necessarily not obvious
consensus and so there's a proposal
process that uh then allows the core
team and the community to work this out
and what the core team does is it aims
to get consensus out of the community
and provide gu guard rails but also
provide
long-term make sure we're going the
right direction kind of things so does
that group represent like the how much
people will love the user interface like
you think to capture that well I mean
it's something we talk about a lot
something we care about how well we how
well we do that Up For Debate but I
think that we've done pretty well so far
is the beginner in mind like cuz you
said the progressive disclosure complex
yeah so we care a lot about uh a lot
about that a lot about power a lot about
efficiency a lot about there are many
factors to good design and you have to
figure out a way to kind of work your
way through that and so if you like
think about like a language I love is
lisp probably still because I use Zac
but I haven't done anything any serious
working list but it has a ridiculous
amount of parentheses yeah um I've also
you know with Java and
C++ uh the
braces um you know I I like I I I
enjoyed the comfort of being between
braces you know python is really sorry
to interrupt just like and last thing to
me as a design if I was a language
designer uh God for bit is I would be
very surprised that python with no
braces would nevertheless
somehow be comforting also so like I can
see Arguments for all of these but look
at this this is evidence that it's not
about braces versus tevs right exactly
you're good that's a good point right so
like you know there there's there's
evidence that but see like it's one of
the most argued about things oh yeah of
course just like tabs and spaces which
it does I mean there's one obvious right
answer but it doesn't it doesn't
actually matter what's that come on
we're friends like come on what are you
trying to do to me here people are going
to yeah half the people are going to
tune out yeah um so so do you're able to
identify things that don't really matter
for the experience well no no no it's
it's it's always a really hard so the
easy decisions are easy right I mean you
you C fine those are not the interesting
ones the hard ones are the ones that are
most interesting right the hard ones are
the places where hey we want to do a
thing everybody agrees we should do it
there's one proposal on the table but it
has all these bad things associated with
it well okay what are we going to do
about that do we just take it do we
delay it do we say hey well maybe
there's this other feature that if we do
that first this will work out better um
how does this if if we do this are we
painting ourselves into a corner right
and so this is where again you're having
that core team of people that uh has
some continuity and has perspective has
some of the historical understanding is
really valuable because you get um it's
not just like one brain you get the
power of multiple people coming together
to make good decisions and then you get
the best out of all these people and you
also can harness the the community
around it what about like the decision
of whether like in Python having one
type or having you know uh strict typing
yeah yeah let's talk about this so so um
I I like how you put that by the way
like so so many people would say that
python doesn't have types doesn't have
types yeah I've listened to you enough
to where okay I'm I'm a fan of yours and
listened to way too many podcast and
videos talking about this oh yeah so I
would argue that python has one type and
so um so like when you import python
into Swift which by the way works really
well you have everything comes in as a
python object now here there trade-offs
because um uh you know it depends on
what you're optimizing for and python is
a super successful language for a really
good reason um because it has one type
uh you get duck typing for free and
things like this but also you're pushing
you're making it very easy to to pound
out code on the one hand but you're also
making it very easy to introduce uh
complicated bugs the have debug and you
pass the string into something that
expects an integer and it doesn't
immediately die it goes all the way down
the stack trace and you find yourself in
the middle of some code that you really
didn't want to know anything about and
it blows up and you're just saying well
what did I do wrong right and so types
are good and bad and they have
trade-offs they're good for performance
and certain other things depending on
where you're coming from but it's it's
all about trade-offs and so this is this
is what design is Right design is about
weighing tradeoffs and trying to
understand the ramifications of the the
things that you're weighing like types
or not or one type or many types um but
also within many types how powerful do
you make that type system is another
very complicated question uh with lots
of trade-offs it's very interesting by
the way uh but uh but that's like one
one
dimension and there's a bunch of other
dimensions jit compiled versus static
compiled garbage collected versus
reference counted versus memory man
manual memory management versus you know
like in like all these different
trade-offs and how you balance them are
what make a programm language good
currency y so and all those things I
guess uh when you're designing the
language you also have to think of how
that's going to get all compiled down to
if you care about performance yeah well
and go back to list right so list also I
would say JavaScript is another example
of a very simple language right and so
one of the so I also love lisp I don't
use it as much as maybe you do or you
did no I think we're both everyone who
loves lisp it's like you love it's like
I don't know I love Frank Sinatra but
like how often do I seriously listen to
Franks sure but but but you look at that
or you look at JavaScript which is
another very different but relatively
simple language and there's certain
things that don't exist in the language
but there's there is inherent complexity
to the problems that we're trying to
model and so what happens to the
complexity in the case of uh both of
them for example you say well what about
about large scale software development
okay well you need something like
packages neither language has a like
language affordance for packages and so
what you get is patterns you get things
like npn you get things like you know
like these ecosystems that get built
around and I'm a believer that if you
don't uh model at least the most
important inherent complexity in the
language then what ends up happening is
that complexity gets pushed
elsewhere and when it gets pushed
elsewhere sometimes that's great because
often building things as libraries is
very flexible and very powerful and
allows you to evolve and things like
that but often it leads to a lot of uh
unnecessary Divergence in the force and
fragmentation and and when that happens
you just get kind of a mess yeah and so
the question is how do you how do you
balance that uh don't put too much stuff
in the language because that's really
expensive and makes things complicated
but how do you model enough of the
inherent complexity of the problem that
um you provide the framework and the
structure for people to think about Al
so so the the the the key thing to think
about with uh with programming languages
and you think about what a programming
language is there for is it's about
making a human more productive right and
so like there's an old I think it's
Steve Jobs quote about um it's a bicycle
for the mind right you can you can you
can definitely
walk but you'll get there a lot faster
if you can bicycle on your way and a
programming language is a bicycle for
the mind yeah is basically a wow that's
a really interesting way to think about
it by by raising the level of
abstraction now you can fit more things
in your head by being being able to just
directly leverage somebody's Library you
can now get something done quickly um in
the case of Swift swift UI is this new
framework that Apple has released
recently for doing UI programming and it
has this declarative programming model
which defines away entire classes of
bugs it's make it builds on value
sematics and many other nice Swift
things and what this does allows you
just get way more done with way less
code and now your productivity as a
developer is much higher right and so
that that's really the what programming
languages should be about is it's not
about tabs versus spaces or curly braces
or whatever it's about how productive do
you make the person and you can only see
that when you have libraries that were
built with the right intention that the
language was designed for and with Swift
I think we're still a little bit early
um but Swift UI and many other things
that are coming out now are really
showing that and I think that they're
opening people's eyes it's kind of
interesting to think about like
how that you know then knowledge of
something of how good the bicycle is how
people learn about that you know so I've
used C++ now this is not going to be a
trash talking session about C++ but use
C++ for a really long go there if you
want I have the
scars I I feel like I spent many years
without realizing like there's languages
that could for my particular LIF style
brain style thinking style there's
languages that that could make me a lot
more productive uh in the debugging
stage in the just the development stage
and thinking like the bicycle for the
mind I can fit more stuff into my
Python's a great example of that right I
mean a machine learning framework in
Python is a great example of that it's
just very high abstraction level and so
you can be thinking about things on a
like very high level Al algorithmic
level instead of thinking about okay
well am I copying this tensor to a GPU
or not right it's not it's not what you
want to be thinking about and as I was
telling you I mean I guess I guess the
question I head is uh you know how does
a person like me or in general people
discover more
productive uh you know languages like
how I was as I've been telling you
offline I've been looking for like a
project to work on in Swift so I can
really uh try it out as I mean my
intuition was like doing a hello world
is not going to get me there uh to to to
get me to experience the power of the
language you need a few weeks to change
your metabolism exactly I put uh that
that's one of the problems with people
with diets like I I'm I'm actually
currently to go in parallel but in a
small tangent is I've been recently
eating only meat okay okay and okay so
most people are like uh think that's
horribly unhealthy or whatever you have
like a million It Whatever the science
is it just doesn't sound right well so
so back when I was in college we did the
Atkins diet that was that was a thing
similar and but if you you have to
always give these things a chance I mean
with dieting always not dieting but just
the things that you like if I eat
personally if I eat meat just everything
I could be super F or more focused than
usual I just feel great I I've been I've
been running a lot you know doing
push-ups and pull-ups and so on I mean
python is similar in that sense for me
where you going with
this I mean literally I just I felt I
had like a stupid smile on my face when
I first started using python I could uh
code up really quick things like I like
I I would see the world I'll be
empowered to write a script to to um you
know to do some basic data processing to
rename files on my computer yeah right
like Pearl didn't do that for me uh uh I
mean kind a little bit well and again
like none of these are about which which
is best or something like that but there
there's definitely better and worse here
but it clicks right well yeah it if you
look at Pearl for example you get bogged
down in uh scalers versus arrays versus
hashes versus type Globs and like all
that kind of stuff and and Python's like
yeah let's not do this right and some of
is debuging like everyone has different
priorities but for me it's could I
create systems for myself that Empower
me to debug quickly like I've always
been a big fan even just crude like
asserts like
always uh stating things that should be
true uh which in Python I found myself
doing more because of type all these
kinds of stuff well you could think of
types in a programming language as being
kind of assert yeah they get check at
compile time right um so how do you
learn a new thing well so this or how do
how do people learn new things right
this this is hard uh people don't like
to change people generally don't like
change around them either and so uh
we're all very slow to adapt and change
and usually there's a catalyst that's
required to to force yourself over the
over over the
so for learning a programming language
it really comes down to finding an
excuse like build a thing that that's
that the language is actually good for
that the ecosystem is ready for um and
so um and so if you were to write an IOS
app for example that would be the easy
case obviously you would use Swift for
that right there are other
Android Swift runs on Android oh does it
oh yeah yeah Swift runs in lots of
places so uh okay so Swift Swift swift
is built on top of lvm lvm runs
everywhere lvm for example builds the
Android kernel oh wow okay so um okay I
didn't realize this yeah so Swift swift
is very portable runs on Windows there's
it runs on lots of different things and
Swift side Swift UI and then there's a
thing called UI kit so can I build an
app with Swift uh well so that that's
the thing is the ecosystem is what
matters there so Swift UI and uiit are
Apple Technologies okay got it and so
they happen to like Swift eii happens to
be written in Swift but it's an apple
proprietary framework that um Apple
loves and wants to keep on its platform
which makes total sense you go go to
Android and you don't have that Library
yeah right and so Android has a
different ecosystem of things that
hasn't been built out and doesn't work
as well with Swift and so you can
totally use Swift to do uh like
arithmetic and things like this but
building a UI with Swift on Android is
not not not a not a great experience
right now so so if I wanted to uh so
learn Swift what's the pro I mean the
one practical different version of that
is um Swift for tensorflow for example
and one of the inspiring things for me
with both tensorflow and pytorch is how
quickly the community can like switch
from different libraries y like you
could see some of the communi switching
to pytorch now but it could it's very
easy to see and then tensor flow is
really stepping up its game and then
there's no reason why I think it the way
it works basically there has to be one
GitHub repo like one paper steps up to
get gets people excited gets people
excited and they're like ah I have to
learn this Swift for what what Swift
again like and then they learn and they
fall in love with I mean that's what
happen PTO has there has be a reason a
catalyst yeah and so and and there I
mean people don't like change but it
turns out that once you've worked with
one or two programming languages they're
the basics are pretty similar and so one
of the fun things about learning
programming languages even even maybe
list I don't know if you agree with this
is that when you start doing that you
start learning new
things because you have a new way to do
things and you're forced to do them and
that forces you to explore and it puts
you in learning mode and when you get in
learning mode your mind kind of opens a
little bit and you can you can see
things in a new way even when you go
back to the old place right yeah it's
totally well Lis is functional yeah uh
stuff but I wish there was a kind of
window maybe you can tell me if there is
uh there you go this this a question
uh to ask what is the most beautiful
feature in a programming language before
I ask it let me say like with python I
remember when I saw list
comprehensions okay was like when I like
really took it in yeah it I don't know I
just loved it it was like fun to do like
it was fun to do that kind of um uh yeah
there was something about it to be able
to filter through a list and to create a
new list all in a single line was
elegant I could all get into my head and
it just made me um fall in love with the
language so is there let me ask you a
question uh is there what do use the
most beautiful feature in uh in a
programming languages that you've ever
encountered in Swift maybe and then
outside of Swift I think the thing that
I like the most from a programming
language so so I think the thing you
have to think about with the programming
language again what is the goal you're
trying to get people to get things done
quickly and so you need libraries you
need high quality libraries and then you
need a user base around them that can
assemble them and do cool things with
them right and so to me the question is
what enables high quality
libraries okay yeah and there's a huge
divide in the world between libraries
who enable highquality
libraries versus um the ones that put
special stuff in the language so
programming languages that enable high
quality libr high quality libraries got
it so so and what I mean by that is
expressive libraries that then feel like
a natural integrated part of the
language itself MH so um an example of
this in Swift is that int and float and
also array and string things like this
these are all part of the library like
int is not hard-coded into
Swift and so what that means is that
because int is just a Library Thing
defined in the standard Library along
with strings and arrays and all the
other things that come with the standard
Library um well hopefully you do like
int but anything that any language
features that you needed to Define int
you can also use in your own types so if
you want to define a uh querian or
something like this right um well it
doesn't come in the standard Library um
there's a very special set of people
that care a lot about this but those
people are also important it's not it's
not about classism right it's not about
the people who care about instant floats
are more important than the people who
care about querian and so to me the
beautiful things about about programming
languages is when you allow those
communities to to build high quality
libraries that feel native that feel
like they're built into the built into
the compiler without having to
be what does it mean for the int to be
part of not hardcoded in so is it like
how so what is an what is an INT okay
int is just a integer in this case it's
like a you know like a 64-bit integer or
something like this but so like the
64-bit is hardcoded or no no none of
that's hardcoded so int int if you go
look at how it's implemented is it's
just a struct and Swift and so it's a
struct and then how do you add two
structs well you define plus and so you
can Define Plus on int well you can
Define Plus on your thing too you can
Define uh int has like an is OD method
or something like that on it and so yeah
you can add methods onto things yeah uh
so you can you can def find operators
like how it behaves yeah that to is
beautiful when there there's something
about the language which enables others
to create libraries which are um not
hacky yeah that feel that feel native
and so one of the best examples of this
is lisp MH right because in lisp all
like all the libraries are basically
part of the language right you write
term rewrite systems and things like
this and so can you as a counter example
provide what makes it difficult to write
a library that's native is it the python
C well so well so one example I'll give
you two examples um Java and C++ or Java
and C um they both allow you to Define
your own types um but int is hard code
in the language okay well why well in in
Java for example coming back to this
whole reference semantic value semantic
thing um int gets passed around by
value yeah but if you if you make if you
make like a pair or something like that
a complex number right it's a it's a
class in Java and now it gets passed
around by reference by pointer and so
now you lose value sematics right you
lost math okay well that's not great
right if if you can do something with in
why can't I do it with my type yeah
right so that's
that's the the negative side of the
thing I find beautiful is when you can
solve that when you can have full
expressivity where where you as a user
of the language have as much or almost
as much power as the people who
implemented all the standard built-in
stuff because what that enables is that
enables truly beautiful libraries you
know it's kind of weird cuz I've gotten
used to that uh that's one I guess other
aspect of program language design you
have to think you know the old uh first
principles thinking like why are we
doing it this way by the way I mean I
remember cuz I was thinking about the
wallers operator and I'll ask you about
it later but it it hit me that like the
equal sign for assignment yeah like why
are we using the equal sign for
assignment and that's not the only
solution right so if you look at Pascal
they use colon equals for assignment and
equals for um for equality and they use
like less than greater than instead of
the not equal thing like there are other
answers here so but like and yeah like
ask you all but how do you then
decide uh to break convention to say you
know what
this everybody's doing it wrong we're
gonna do it right yeah so so it's like
an Roi like return on investment
tradeoff right so if you do something
weird let's just say like not like colon
equal instead of equal for assignment
that would be weird with today's
aesthetic right and so you'd say cool
this is theoretically better but is it
better in which ways like what do I get
out of that do I Define away class of
bugs well one of the class of bugs that
c has is that you can use like you know
if x equals without equals equals f x
equals y yeah right well turns out you
can solve that problem in lots of ways
clang for e
Resume
Read
file updated 2026-02-13 13:24:43 UTC
Categories
Manage