1
00:00:03,106 --> 00:00:06,726
Welcome to Compose, a software
development podcast featuring
2
00:00:06,726 --> 00:00:10,056
the Rust programming language and
how it interacts with the world.
3
00:00:11,616 --> 00:00:18,486
This episode features interoperability
with C++ and how that might progress
4
00:00:18,516 --> 00:00:20,511
over the years and even decades ahead.
5
00:00:21,786 --> 00:00:24,486
To talk us through it all
is David Sankel from Adobe.
6
00:00:25,266 --> 00:00:28,816
David is an invited speaker at
this year's Rust Forge Conference.
7
00:00:29,536 --> 00:00:32,476
Rust Forge itself is happening
in Wellington, New Zealand, and
8
00:00:32,476 --> 00:00:33,826
you're still very welcome to come.
9
00:00:35,446 --> 00:00:38,566
For those of you who would even
like a discount, try visiting
10
00:00:38,876 --> 00:00:42,836
rustforgeconf.com/compose.
11
00:00:46,301 --> 00:00:48,781
I guess I'm at heart a a computer nerd.
12
00:00:48,901 --> 00:00:53,996
So I'm sitting here and in front of me is
like these little microprocessors, right?
13
00:00:53,996 --> 00:00:55,286
That I'm just programming for fun.
14
00:00:55,796 --> 00:00:59,076
But I guess who I am probably of
interest to this community, I am a
15
00:00:59,076 --> 00:01:03,996
principal scientist at Adobe and I
run Adobe Software Technology Lab.
16
00:01:04,416 --> 00:01:09,386
And that is a team which is focused on
what is going to be happening in the
17
00:01:09,386 --> 00:01:11,936
next 10 years with software development.
18
00:01:12,506 --> 00:01:15,896
And we're very much, our heads are in that
space and we have to figure out how we're
19
00:01:15,896 --> 00:01:18,116
gonna have Adobe align with that future.
20
00:01:18,146 --> 00:01:22,126
And also how can we help steer
the industry so that it can
21
00:01:22,126 --> 00:01:24,466
better support what's going
to be happening going forward.
22
00:01:24,466 --> 00:01:26,026
So that's my day job.
23
00:01:26,096 --> 00:01:30,476
And I'm also very involved in C++
Standardization committee, and now more
24
00:01:30,476 --> 00:01:34,936
recently involved in Rust and specifically
Rust Interop and doing that at Adobe.
25
00:01:34,936 --> 00:01:35,566
So that's
26
00:01:36,016 --> 00:01:38,631
I feel like for many people that
kind of sounds like a bit of
27
00:01:38,631 --> 00:01:40,561
a dream job, look, basically.
28
00:01:41,701 --> 00:01:42,871
It is a dream job.
29
00:01:43,031 --> 00:01:45,021
Let me tell you a story about
that because it's funny.
30
00:01:45,021 --> 00:01:48,691
So Sean parent who is known in the
C++ community was running this team.
31
00:01:49,091 --> 00:01:51,611
And he invited me to, to join it.
32
00:01:51,701 --> 00:01:55,181
And he said that this is, she sold
it pretty much as a dream job.
33
00:01:55,271 --> 00:01:58,391
And it was like, this is my dream job.
34
00:01:59,081 --> 00:02:02,231
And I got there and he convinced
me to swap positions with him.
35
00:02:02,441 --> 00:02:05,261
So I would run the team and
he would have my dream job.
36
00:02:05,441 --> 00:02:07,121
And he managed that.
37
00:02:07,271 --> 00:02:09,251
And I was like, I see what you did there.
38
00:02:09,311 --> 00:02:13,841
You created the dream job and then
you took it for yourself and made
39
00:02:13,841 --> 00:02:16,181
me the manager of the team, which
is, slightly less than the dream
40
00:02:16,181 --> 00:02:17,411
job of actually being on the team.
41
00:02:17,451 --> 00:02:17,811
But yeah
42
00:02:17,861 --> 00:02:24,201
It is, it takes a certain amount of
humility to humility is possibly the
43
00:02:24,201 --> 00:02:32,541
wrong word, but to be really, and
supportive of others and actually sharing
44
00:02:32,541 --> 00:02:35,481
in the facilitation of others' success.
45
00:02:35,481 --> 00:02:41,391
And so the being a manager is, I actually
think that's a better paid, let's say, but
46
00:02:41,391 --> 00:02:44,571
also a slightly underrated career track.
47
00:02:45,001 --> 00:02:48,061
People look down on management
in some ways as no longer
48
00:02:48,061 --> 00:02:49,171
being technical or something.
49
00:02:49,171 --> 00:02:53,961
But I think that it it is in some sense,
gracious that you are able to give
50
00:02:53,961 --> 00:02:59,331
that up and just to enable, let's say,
multiply your own thoughts by X. So
51
00:02:59,341 --> 00:03:00,781
that's a good thing too, in my opinion.
52
00:03:01,781 --> 00:03:02,771
Oh yeah, definitely.
53
00:03:02,861 --> 00:03:06,891
And I say this mostly in jest and
as lead of software technology
54
00:03:06,891 --> 00:03:10,761
lab, I'm still very much involved
in doing the actual technology.
55
00:03:10,831 --> 00:03:11,701
'Cause it's a very small team.
56
00:03:11,701 --> 00:03:13,561
There's only four people in the team.
57
00:03:13,991 --> 00:03:18,051
So yeah, I get to stay hands on and do all
the crap work that Sean was doing before.
58
00:03:18,141 --> 00:03:21,471
So I'm happy to have him spend his time
not doing that crap work and take that
59
00:03:21,516 --> 00:03:21,756
Yeah,
60
00:03:21,756 --> 00:03:24,336
look, some people have to be
professional, meaning goers, now
61
00:03:25,336 --> 00:03:25,556
Yes.
62
00:03:25,666 --> 00:03:32,086
anyway, we're gonna need the like
the actual chip number or like the
63
00:03:32,331 --> 00:03:35,241
part number of the microcontroller
that you're playing with at some
64
00:03:35,241 --> 00:03:37,021
point because I'm sure that the,
65
00:03:37,466 --> 00:03:41,726
This is the STM32C011J4M6.
66
00:03:41,966 --> 00:03:42,266
There you go.
67
00:03:42,321 --> 00:03:46,911
For anyone that is coming to Rust Forge
in, I guess it's six weeks time from
68
00:03:46,911 --> 00:03:52,961
this recording, Espressif is actually
donating several dozen microcontrollers.
69
00:03:52,991 --> 00:03:55,871
We haven't actually announced
this, so this is the big reveal,
70
00:03:56,201 --> 00:03:57,821
but it should be the case.
71
00:03:58,211 --> 00:04:00,306
I hope we're getting at least
one for everyone that it
72
00:04:00,306 --> 00:04:01,481
turn, that, that turns up.
73
00:04:01,841 --> 00:04:05,441
Yeah, no, so there, there's a segue in
there as well, but that's really great
74
00:04:05,981 --> 00:04:06,431
and.
75
00:04:07,356 --> 00:04:08,796
I am gonna be first in
line for that thing.
76
00:04:08,831 --> 00:04:09,311
Awesome.
77
00:04:09,731 --> 00:04:10,151
Awesome.
78
00:04:10,571 --> 00:04:17,501
The the next thing is, so it, you
are looking at the next 10 years of
79
00:04:17,501 --> 00:04:22,451
programming, let's say, in a very broad
way... rust is part of that story.
80
00:04:23,451 --> 00:04:23,841
Yes.
81
00:04:24,201 --> 00:04:29,231
When do you think large companies,
such as Adobe or there are many
82
00:04:29,501 --> 00:04:34,391
billion dollar companies, let's say,
when do you think large enterprises
83
00:04:34,901 --> 00:04:37,526
would've really started to notice rust?
84
00:04:38,526 --> 00:04:40,326
I think it's already started.
85
00:04:40,536 --> 00:04:41,636
And I can tell you
86
00:04:41,636 --> 00:04:42,481
Please do.
87
00:04:42,601 --> 00:04:42,841
Yeah.
88
00:04:42,896 --> 00:04:43,616
from the beginning.
89
00:04:43,626 --> 00:04:47,936
Back in 2024 they created
this memory Safety tiger team.
90
00:04:48,326 --> 00:04:48,596
Okay.
91
00:04:48,596 --> 00:04:52,506
And it included reps from security,
the software technology lab developer
92
00:04:52,536 --> 00:04:56,346
experience, and legal reps. And the
reason that it was created is because
93
00:04:56,346 --> 00:05:01,056
there was all this discussion of
legislation related to memory safety.
94
00:05:01,656 --> 00:05:05,526
And they wanted to figure
out like, what is this?
95
00:05:05,526 --> 00:05:06,936
What are we gonna do about it?
96
00:05:07,036 --> 00:05:11,826
And you had the NSA you had,
cisa, you had the White House
97
00:05:11,826 --> 00:05:13,266
even chiming in on this stuff.
98
00:05:13,326 --> 00:05:16,626
And at one point there was even a bill, I
think it was like a defense spending bill,
99
00:05:16,626 --> 00:05:20,441
like a typical bill that, that when it
was in the House of Representatives, the
100
00:05:20,441 --> 00:05:26,171
Congress they had like creating a memory
safety plan for the Department of Defense.
101
00:05:26,291 --> 00:05:30,101
And this little line got removed
when it went in the Senate.
102
00:05:30,501 --> 00:05:33,561
So it didn't actually end up in the
final thing that got approved, but the
103
00:05:33,561 --> 00:05:36,441
fact that it was there was like huge.
104
00:05:36,861 --> 00:05:39,921
And so this team got together
and we're like, okay, what
105
00:05:39,921 --> 00:05:41,481
do we need to do about this?
106
00:05:41,481 --> 00:05:45,611
And we investigated and we looked
at what was going on with like the
107
00:05:45,611 --> 00:05:47,051
published data that people were having.
108
00:05:47,051 --> 00:05:50,051
So you look at the numbers, it's okay,
the number of exploits in software
109
00:05:50,441 --> 00:05:55,511
that are due to memory safety versus
all the other exploits was like 70%.
110
00:05:55,841 --> 00:05:58,891
And you look at Microsoft's
numbers, it's 70%.
111
00:05:58,891 --> 00:06:01,211
You look at Google's numbers at 70%.
112
00:06:01,271 --> 00:06:03,811
And then we looked internally
and it's yeah, it's also
113
00:06:03,811 --> 00:06:04,951
right around that number too.
114
00:06:04,951 --> 00:06:09,961
So there, there's like something to this
and the idea that you can switch your
115
00:06:09,961 --> 00:06:15,931
technology and get rid of 70% of your
memory safety vulnerabilities like that.
116
00:06:16,591 --> 00:06:17,086
That was a big
117
00:06:17,176 --> 00:06:17,396
And
118
00:06:18,081 --> 00:06:22,551
my recollection of those papers as well,
it's not just 70% of bugs, let's say, but
119
00:06:22,581 --> 00:06:25,851
70% of severe and critical, severe use.
120
00:06:25,881 --> 00:06:27,096
So it's like these are the.
121
00:06:27,841 --> 00:06:31,261
The majority of the worst
cases of security problems.
122
00:06:31,651 --> 00:06:37,231
And yeah and we, and so this was a,
so I guess it sounds like there were
123
00:06:37,231 --> 00:06:41,661
probably engineers thinking, ah, for
the last multiple decades, and I'd
124
00:06:41,661 --> 00:06:47,261
be interested in C++ has had this
in front of mind for a long time.
125
00:06:47,801 --> 00:06:52,841
How do we deal with buffer overflows and
how do we deal with memory safety in a
126
00:06:52,841 --> 00:06:57,941
way that is strongly backwards compatible,
which I suppose is the C++ mantra really.
127
00:06:58,581 --> 00:07:05,861
And then we have this new programming
language, which somehow is able to
128
00:07:05,951 --> 00:07:12,671
offer memory safety without imposing
garbage collection or some sort of
129
00:07:12,671 --> 00:07:17,921
other form of runtime checking to
be able to allow things to work.
130
00:07:19,001 --> 00:07:24,641
But it was really the, it sounds like it
was really the fact that it had started
131
00:07:24,641 --> 00:07:30,671
to introduce legal risk that really
started to motivate internal people to
132
00:07:30,671 --> 00:07:34,181
say, okay, we're gonna fund something,
at least some sort of discussion to make
133
00:07:34,181 --> 00:07:35,771
a decision on how we're gonna proceed.
134
00:07:36,771 --> 00:07:43,901
It, for us, like the legal risk was why
upper level management got involved and
135
00:07:43,901 --> 00:07:46,301
they said, can you investigate this?
136
00:07:46,931 --> 00:07:51,101
When we investigated it, it wasn't like,
oh yes, there is significant legal risk.
137
00:07:51,101 --> 00:07:53,011
We're looking at these,
laws that are coming out.
138
00:07:53,431 --> 00:07:54,391
It was more.
139
00:07:55,361 --> 00:07:56,081
What about
140
00:07:56,166 --> 00:07:56,606
Yeah.
141
00:07:56,606 --> 00:07:56,966
actually.
142
00:07:57,101 --> 00:08:01,001
want our customers to use safe software.
143
00:08:01,451 --> 00:08:02,771
That's totally in our interest.
144
00:08:02,811 --> 00:08:06,471
And that's actually our driving
motivation in the, in this group,
145
00:08:06,471 --> 00:08:10,251
is we want to produce the most safe
software that we can for our consumers.
146
00:08:10,251 --> 00:08:15,991
You imagine, if somebody comes out
with a PDF that exploits your computer,
147
00:08:16,171 --> 00:08:17,791
how many people are using Acrobat?
148
00:08:17,841 --> 00:08:21,171
We, look, there's more people using,
have Acrobat Reader on their computer
149
00:08:21,381 --> 00:08:22,851
than people that use Firefox,
150
00:08:23,031 --> 00:08:24,081
like in total.
151
00:08:24,291 --> 00:08:28,561
So it's a huge swath and if you
take state actors or whatever yeah,
152
00:08:28,561 --> 00:08:30,951
if you wanna, get into people's
computers, you're gonna try to get
153
00:08:30,951 --> 00:08:32,751
in the software that most people use.
154
00:08:32,781 --> 00:08:34,431
And we're definitely in that space.
155
00:08:34,461 --> 00:08:34,731
Yeah.
156
00:08:34,731 --> 00:08:39,891
and PDF is not a simple format
to protect against really.
157
00:08:40,051 --> 00:08:43,291
I don't mean this, I don't mean to
cast any shade, but we've got multiple
158
00:08:43,291 --> 00:08:44,581
programming language interpreters.
159
00:08:44,581 --> 00:08:49,231
There's at least a JavaScript runtime
plus there's two other languages, right?
160
00:08:49,231 --> 00:08:53,941
It's own little macro language as well
as Postscript in there too, I think.
161
00:08:54,181 --> 00:08:54,541
but.
162
00:08:55,541 --> 00:08:57,281
It is extremely complicated.
163
00:08:57,281 --> 00:08:57,761
Yes.
164
00:08:57,841 --> 00:09:01,321
And the fact that it can embed a
JPEG or something like that and
165
00:09:01,411 --> 00:09:01,711
Oh yeah.
166
00:09:01,741 --> 00:09:06,151
'cause now every single codec that
you support also has decompression.
167
00:09:06,241 --> 00:09:10,821
And you've also got inter essentially,
like you have these baby interpreters
168
00:09:10,821 --> 00:09:13,911
for file formats, which are also
exploitable as browser vendors
169
00:09:13,911 --> 00:09:15,591
have discovered multiple times.
170
00:09:16,591 --> 00:09:16,831
Yeah.
171
00:09:16,831 --> 00:09:17,791
And, okay.
172
00:09:17,881 --> 00:09:24,331
So that would be good to be able to
defend against these kind of poisoned
173
00:09:24,361 --> 00:09:29,341
PDFs, which of course this is, that
that's a horrifically big vector of
174
00:09:29,701 --> 00:09:33,331
problems because of course you're going
to double click the PDF and open it.
175
00:09:33,491 --> 00:09:34,991
When you get that via email.
176
00:09:35,991 --> 00:09:36,441
Yeah.
177
00:09:37,141 --> 00:09:40,771
But like on the flip side, so from a
software technology lab perspective
178
00:09:41,371 --> 00:09:45,751
before memory safety became something
that everybody knew about and was
179
00:09:45,751 --> 00:09:49,261
talking about, we were already trying
to figure out what's going to be
180
00:09:49,771 --> 00:09:51,421
the future of programming languages.
181
00:09:51,731 --> 00:09:52,611
Is it going to be C++?
182
00:09:53,241 --> 00:09:54,921
Is it gonna be one of
these other languages?
183
00:09:55,251 --> 00:09:59,631
And from our perspec perspective on
that team, the memory safety wasn't
184
00:09:59,631 --> 00:10:03,461
actually the most interesting thing
about rust, as a language to move to.
185
00:10:04,031 --> 00:10:09,401
It's just, flatly better tech for
most applications, even if you didn't
186
00:10:09,401 --> 00:10:14,231
have the memory safety aspect, if you
look at like enums pattern matching
187
00:10:14,231 --> 00:10:19,341
traits, like all the procedurally macro
driven libraries that are in there.
188
00:10:19,731 --> 00:10:22,881
And there's a lot of stuff like
that just made it interesting.
189
00:10:23,121 --> 00:10:26,241
Hey, we want people to develop in these
languages because they're gonna be more
190
00:10:26,241 --> 00:10:29,871
productive and the code they're writing
is gonna be more maintainable and it's
191
00:10:29,871 --> 00:10:33,171
gonna be easier to hire developers
because it's easier to get them to learn
192
00:10:33,171 --> 00:10:34,491
the language and be able to work on it.
193
00:10:34,491 --> 00:10:38,811
This, these are like other big drivers
that I think stand on their own
194
00:10:38,811 --> 00:10:40,791
without even looking at the memory
195
00:10:40,986 --> 00:10:46,656
Yeah, I have been in very similar
discussions where people look and say,
196
00:10:46,686 --> 00:10:48,366
oh gosh, we've got this huge problem.
197
00:10:48,516 --> 00:10:49,956
And that's the motivating factor.
198
00:10:50,106 --> 00:10:53,316
But it turns out that rust is also
a very good programming language
199
00:10:53,616 --> 00:10:55,116
and it has lots of nice things.
200
00:10:55,116 --> 00:10:59,606
We have Iterators, for example, that
compose and just chain together quite
201
00:10:59,606 --> 00:11:01,976
nicely and also get optimized quite well.
202
00:11:02,426 --> 00:11:09,426
and then, from the point of view of
comparing rust to, let's say a Java C
203
00:11:09,426 --> 00:11:14,736
Sharp or even a Python or something,
and my background is primarily in web
204
00:11:14,736 --> 00:11:18,276
services and so forth, but we would
also say that we could probably reduce
205
00:11:18,276 --> 00:11:23,416
memory by, I don't know, 90% and
the cost of running an application.
206
00:11:23,516 --> 00:11:28,566
Suddenly we only require 80
megabytes of RAM at steady state.
207
00:11:28,566 --> 00:11:31,866
So we don't need giant instances
with lots and lots of heap.
208
00:11:32,016 --> 00:11:36,636
So actually we are able to produce
applications that run faster, serve
209
00:11:36,636 --> 00:11:38,616
users quicker, and or also more secure.
210
00:11:38,616 --> 00:11:42,346
And yeah, and by the way, yeah, also rust
is quite a nice programming language.
211
00:11:43,346 --> 00:11:48,326
And now we've got this other problem
that, you are advocating for a
212
00:11:48,326 --> 00:11:53,906
programming language or at least saying
to the rest of the company, by the
213
00:11:53,906 --> 00:11:56,901
way the grass is greener over there.
214
00:11:57,901 --> 00:12:02,591
How, but at some point, the
immune system of the organization
215
00:12:02,801 --> 00:12:10,251
responds to you and says, ah, we
have a lot of other languages.
216
00:12:10,251 --> 00:12:12,561
We don't want to add
another one to the mix.
217
00:12:13,561 --> 00:12:14,131
Yep.
218
00:12:14,501 --> 00:12:18,851
And we're definitely see those really
healthy immune system responses
219
00:12:18,941 --> 00:12:20,111
just like any, anywhere else.
220
00:12:20,621 --> 00:12:24,016
And I think that a lot
of what's been useful.
221
00:12:25,166 --> 00:12:29,246
To dispel some of the concerns
that people have has been the great
222
00:12:29,246 --> 00:12:31,106
data that's been put out there.
223
00:12:31,446 --> 00:12:36,366
So one of the concerns someone might say
is oh, but Rust is really complex, right?
224
00:12:36,416 --> 00:12:37,916
It's a hard language to learn.
225
00:12:38,366 --> 00:12:41,456
We can't wait for people to spend
three years learning this language
226
00:12:41,516 --> 00:12:43,136
to be able to be productive in it.
227
00:12:44,026 --> 00:12:48,086
And then for that point out to the
Google study that came out where it
228
00:12:48,086 --> 00:12:52,056
was like, I think it was after three
months of development and rust from
229
00:12:52,056 --> 00:12:55,656
someone that has no experience at the
beginning, two thirds outta people
230
00:12:55,916 --> 00:12:59,906
felt like they were very confident and
productive in this language, right?
231
00:12:59,906 --> 00:13:02,216
So that you just point to the data.
232
00:13:02,216 --> 00:13:06,126
It's like you can go with your
anecdotal, feeling about it, but
233
00:13:06,126 --> 00:13:08,166
why do that when we can look at the
data when there's been like, good
234
00:13:08,166 --> 00:13:09,336
studies that have been put out there.
235
00:13:09,766 --> 00:13:13,066
And so a lot of things like this it's
just like getting the right information
236
00:13:13,066 --> 00:13:14,356
in front of people so that they can.
237
00:13:14,971 --> 00:13:16,651
They don't have to go based on their gut.
238
00:13:16,651 --> 00:13:19,021
They can go based on something
more solid and tangible.
239
00:13:19,151 --> 00:13:20,626
I think that's been extremely helpful.
240
00:13:20,781 --> 00:13:23,151
I've never worked at Google, but
I've got lots of friends there.
241
00:13:23,781 --> 00:13:29,841
And one of the things that makes me
believe that research is that Google
242
00:13:29,841 --> 00:13:35,541
has full control over its build system
and the developer experience as well.
243
00:13:35,966 --> 00:13:36,296
Mm-hmm.
244
00:13:36,371 --> 00:13:39,101
of the things that I would
really like to pick up on was
245
00:13:39,221 --> 00:13:40,841
another claim around hiring.
246
00:13:41,141 --> 00:13:43,781
'cause I've heard that hiring
rust developers is really hard.
247
00:13:44,781 --> 00:13:50,391
So one thing I can say is that hiring
C++ developers is incredibly hard.
248
00:13:50,991 --> 00:13:54,441
And for us I can't share with
you the data, but I can say that
249
00:13:54,441 --> 00:13:58,521
it is astronomically harder than
hiring for any other language
250
00:13:58,521 --> 00:14:01,031
that we have especially in the us.
251
00:14:01,371 --> 00:14:04,771
And that is another one of the
motivations as to why we're looking at.
252
00:14:05,521 --> 00:14:08,491
Other languages that we can bring
on developers because if you've
253
00:14:08,491 --> 00:14:13,291
got a new project and you can't
staff it then, but you can change
254
00:14:13,291 --> 00:14:14,341
the language and staff it better.
255
00:14:14,341 --> 00:14:16,621
You may just change the
language based on that alone.
256
00:14:17,251 --> 00:14:22,481
And so we looked a lot at the adoption of
Rust in the wider community and we looked
257
00:14:22,481 --> 00:14:24,521
at again, we're like, let's see the data.
258
00:14:25,061 --> 00:14:29,091
And so there was a Stack Overflow
survey that that came out.
259
00:14:29,091 --> 00:14:34,081
I think if you look at the 2024 Stack
Overflow survey we crunched the data and
260
00:14:34,081 --> 00:14:38,951
we looked at the number of developers
that are C++, and we looked at what
261
00:14:38,951 --> 00:14:41,921
portion of C++ developers right now.
262
00:14:42,481 --> 00:14:47,761
Are also rust developers and it
was 20%, kinda blew our mind.
263
00:14:48,031 --> 00:14:51,061
20% of all C++ developers
are also developing rust.
264
00:14:51,061 --> 00:14:53,881
And this is like the question was
asked like, have you programmed this
265
00:14:53,881 --> 00:14:55,471
seriously, like in the past year?
266
00:14:56,131 --> 00:14:59,581
And that's huge and, but maybe
that's Stack Overflow could be weird.
267
00:14:59,611 --> 00:15:01,051
Only weird people flow out that survey.
268
00:15:01,441 --> 00:15:06,901
But we also looked at the data from
GitHub and one for every five C++
269
00:15:06,901 --> 00:15:10,111
PRs on GitHub, there's one Rust PR.
270
00:15:10,921 --> 00:15:12,931
So again, like similar kind of number.
271
00:15:12,991 --> 00:15:17,521
There's just a lot of people
programming Rust it turns out.
272
00:15:17,851 --> 00:15:21,101
And I've asked this question at
conferences that I give talks at what, how
273
00:15:21,101 --> 00:15:22,511
many of you are programming Rust as well?
274
00:15:22,511 --> 00:15:23,861
It's like similar number everywhere.
275
00:15:23,861 --> 00:15:25,721
It seems to be right around 20%.
276
00:15:26,141 --> 00:15:29,761
And that's changed from
16% like five years ago.
277
00:15:30,121 --> 00:15:33,421
It's just been like a drastic increase
in the number of Rust developers.
278
00:15:33,421 --> 00:15:36,856
So I, I. Do not have concerns
of hiring Rust developers.
279
00:15:36,856 --> 00:15:38,956
If you say you got a rust
position, you got like a bunch
280
00:15:38,956 --> 00:15:43,036
of people going wild because they
would love to do rust full time.
281
00:15:43,096 --> 00:15:47,416
Just because it's, you just feel
better programming in that language.
282
00:15:47,416 --> 00:15:50,086
Like going from Rust back to
C++ kind of hurts a little bit.
283
00:15:50,086 --> 00:15:54,266
You die a little bit inside when you come
back to that C++ project, and so there's
284
00:15:54,286 --> 00:15:59,626
just enough enthusiasm for it that's, that
isn't a concern, although people raise it.
285
00:15:59,686 --> 00:16:01,246
But look at the data again.
286
00:16:01,296 --> 00:16:03,576
It, it really isn't in
actuality a concern.
287
00:16:03,606 --> 00:16:07,986
Yeah, there is a lot of I forget the
term, but it, there's a particular
288
00:16:08,106 --> 00:16:12,816
psychological bias where we are afraid
of change because of its loss aversion, I
289
00:16:12,816 --> 00:16:21,086
think where it's will, people are hesitant
to take on change or risk even when the.
290
00:16:21,971 --> 00:16:24,281
The outcome is likely to be positive.
291
00:16:24,701 --> 00:16:28,691
The other thing that I have found
people resisting is this idea
292
00:16:28,691 --> 00:16:30,521
that Rust is as good as it sounds.
293
00:16:31,331 --> 00:16:34,661
People make this claim around, oh, it's a
really lovely programming language to use.
294
00:16:34,661 --> 00:16:37,241
We finally have a genuine type system.
295
00:16:37,421 --> 00:16:41,561
We have no, we now, pointers don't
really exist in the language.
296
00:16:42,561 --> 00:16:45,531
And it's like, where's the catch?
297
00:16:46,531 --> 00:16:55,396
and I guess the next thing to chat
about would be when so Photoshop sounds
298
00:16:55,396 --> 00:16:57,556
like there are changes happening.
299
00:16:59,206 --> 00:16:59,926
What's happening?
300
00:17:00,926 --> 00:17:01,106
Yeah.
301
00:17:01,206 --> 00:17:07,226
We are we are at the stage to where we've
done a couple of pilot projects of where
302
00:17:07,226 --> 00:17:11,466
we're doing rust inside of Photoshop,
and we're seeing how that's going.
303
00:17:11,466 --> 00:17:12,556
Like what exactly happened?
304
00:17:12,556 --> 00:17:15,286
So we took a team, we said,
okay, we have a project here.
305
00:17:15,596 --> 00:17:18,836
We want you to do this
in rust for Photoshop.
306
00:17:19,166 --> 00:17:20,846
What is your experience of that?
307
00:17:21,266 --> 00:17:26,441
And it came out what you would expect,
the people who use the language loved it.
308
00:17:26,491 --> 00:17:29,561
They're reticent to go back
to like a C++ kind of thing.
309
00:17:30,061 --> 00:17:34,141
Um, after that, um, they saw
the productivity gains, uh,
310
00:17:34,231 --> 00:17:35,821
especially being able to use cargo.
311
00:17:36,091 --> 00:17:38,221
I mean, one of the most
powerful experiences you can
312
00:17:38,221 --> 00:17:39,541
have is when you're like, Hmm.
313
00:17:40,351 --> 00:17:43,591
I think it'd be nice if we had
a, a, a JavaScript interpreter in
314
00:17:43,591 --> 00:17:47,791
this program, and you just add a
JavaScript interpreter with like
315
00:17:47,791 --> 00:17:50,871
one line, uh, in your cargo thing.
316
00:17:51,301 --> 00:17:56,521
But coming from a C++ background that
is black magic, that should not be that
317
00:17:56,821 --> 00:18:02,341
I look who doesn't love tinkering with
sea make or whichever build systems
318
00:18:02,431 --> 00:18:04,531
that you feel like creating today.
319
00:18:04,871 --> 00:18:07,211
Why even have one build system
when you could have four in
320
00:18:07,211 --> 00:18:08,141
your project or something?
321
00:18:08,141 --> 00:18:12,791
I don't mean to be too rude, but Rust
has definitely benefited from being
322
00:18:12,791 --> 00:18:19,196
late essentially, or learning from
the experiences of the past and oh,
323
00:18:19,196 --> 00:18:20,996
that's, so that's really validating.
324
00:18:21,116 --> 00:18:25,106
So you've got this public research,
we've got this Google study,
325
00:18:25,106 --> 00:18:28,286
we've had other kind of language
other wider bits and pieces.
326
00:18:28,496 --> 00:18:35,336
And now internally you're validating that
yourself and you're not proven, you are
327
00:18:35,486 --> 00:18:42,686
that then able to demonstrate that not
just the language is okay, but it would
328
00:18:42,686 --> 00:18:48,786
work well inside the build system or
inside the context of of the rest of the
329
00:18:48,786 --> 00:18:50,526
environment within, inside the company.
330
00:18:51,526 --> 00:18:51,976
Yeah.
331
00:18:52,226 --> 00:18:56,721
There was one thing that the
experience pointed to that was.
332
00:18:57,791 --> 00:18:59,201
Bad for rust.
333
00:18:59,206 --> 00:18:59,486
Okay.
334
00:18:59,491 --> 00:19:01,031
'cause they give outta how many stars?
335
00:19:01,031 --> 00:19:02,711
Three, four outta five stars.
336
00:19:02,711 --> 00:19:03,401
Everything's great.
337
00:19:03,401 --> 00:19:04,091
Hunky dory.
338
00:19:04,571 --> 00:19:09,271
But when you get to the C++ interop, that
was where it was like that's a problem.
339
00:19:09,271 --> 00:19:15,621
And so what we used was c bin gen.
So essentially you're writing these,
340
00:19:16,071 --> 00:19:18,651
the C functions in rust, right?
341
00:19:18,651 --> 00:19:21,241
But that you can call from C and
that'll generate a header, which
342
00:19:21,241 --> 00:19:22,411
we'll call those C functions.
343
00:19:22,781 --> 00:19:25,751
And then the implementation
of those functions will call
344
00:19:25,801 --> 00:19:26,881
your underlying rust code.
345
00:19:27,481 --> 00:19:35,361
And this involves a lot of unsafe, it also
involves a lot of cism stuff that, that
346
00:19:35,361 --> 00:19:38,431
C++ people aren't familiar with, right?
347
00:19:38,431 --> 00:19:39,931
If you go back to the.
348
00:19:40,771 --> 00:19:44,881
Back in the day when you were writing
C callbacks, you have a callback
349
00:19:45,391 --> 00:19:47,941
pointer function that you function,
pointer that you pass in, but you
350
00:19:47,941 --> 00:19:51,301
also have to pass and avoid star
for the context of that callback.
351
00:19:51,301 --> 00:19:54,921
And that's just like this idiom
that you do in C to do callbacks.
352
00:19:55,401 --> 00:19:59,361
But if you want to have a interop
layer in C you have to do this
353
00:19:59,361 --> 00:20:00,441
and you have to understand it.
354
00:20:00,861 --> 00:20:05,901
And so what we found is that when
you take somebody who's like C++, you
355
00:20:05,901 --> 00:20:09,651
know, expert or very familiar with
the language, and the first thing they
356
00:20:09,651 --> 00:20:15,681
need to do is go to the most gnarly,
awful part of rust, which is unsafe.
357
00:20:15,711 --> 00:20:20,631
Weird stuff with pointers,
like that experience is not
358
00:20:20,826 --> 00:20:22,576
so let me paint the picture.
359
00:20:22,696 --> 00:20:24,311
So what we would like to do.
360
00:20:25,976 --> 00:20:31,226
Is basically pass objects around and
their interfaces in some sort of ideal,
361
00:20:31,506 --> 00:20:39,476
essentially extend C++ or like bolt,
either graft rust onto C++ in some way.
362
00:20:39,736 --> 00:20:44,406
Or graft C++ into rust or whatever.
363
00:20:44,426 --> 00:20:50,246
So that a rust programmer could just
interact with methods from C++, uh, as
364
00:20:50,376 --> 00:20:52,956
though they were essentially native.
365
00:20:53,046 --> 00:20:58,746
But we don't have anything like that
because the two compilers don't know
366
00:20:58,746 --> 00:21:00,726
any really, we don't know enough.
367
00:21:01,206 --> 00:21:02,211
They don't know enough about each other.
368
00:21:02,241 --> 00:21:07,156
They it's a, you would need to
teach Rust, all of C++ in order
369
00:21:07,156 --> 00:21:09,716
for that to work in that way.
370
00:21:10,366 --> 00:21:15,096
maybe I should also chat a little bit
about this concept of passing function
371
00:21:15,096 --> 00:21:20,436
pointers around for anyone that's
although maybe you can correct me here,
372
00:21:20,436 --> 00:21:24,866
David, because I'm sure that this isn't
technically precise, but essentially the
373
00:21:24,866 --> 00:21:29,256
C++ and Rust worlds, they need to talk to
each other through symbols in the binary.
374
00:21:29,256 --> 00:21:31,836
So they, when they lo the linker
creates things and all they really
375
00:21:31,836 --> 00:21:33,426
have is text strings to match on.
376
00:21:33,486 --> 00:21:34,696
It's or memory addresses.
377
00:21:35,266 --> 00:21:38,416
That void star is a memory address.
378
00:21:38,596 --> 00:21:42,106
And then C C doesn't really
have a strong type system.
379
00:21:42,106 --> 00:21:46,606
So you can basically say that any
chunk of memory is any given type.
380
00:21:46,606 --> 00:21:51,196
So what you'll typically do is if
you're calling some external function or
381
00:21:51,286 --> 00:21:56,416
trying to call one of its functions is
get the symbol, find, de resolve this.
382
00:21:56,416 --> 00:21:58,126
The, you ask the linker to resolve the.
383
00:21:58,831 --> 00:22:04,231
Memory address, what have you, and then
call the function with a buffer that
384
00:22:04,231 --> 00:22:09,851
you have allocated and then expect,
just hope that the function does what it
385
00:22:09,851 --> 00:22:17,951
says, and then you need to reinterpret
your buffer as the result type.
386
00:22:18,041 --> 00:22:21,171
So essentially this void star
just means any type at all.
387
00:22:21,261 --> 00:22:22,791
How correct was that?
388
00:22:22,911 --> 00:22:24,231
It was that ish.
389
00:22:25,231 --> 00:22:25,681
Yeah.
390
00:22:25,771 --> 00:22:26,011
Yeah.
391
00:22:26,011 --> 00:22:26,491
That's.
392
00:22:26,776 --> 00:22:28,276
That's generally correct.
393
00:22:28,276 --> 00:22:32,706
So when interfacing between C++ and
Rust, if you want to do something
394
00:22:33,186 --> 00:22:38,016
higher level than C right, you're
usually have a C intermediate
395
00:22:38,016 --> 00:22:41,346
layer and the C intermediate layer.
396
00:22:41,396 --> 00:22:45,806
Let's say you want to pass
a C++ object over to Rust
397
00:22:45,876 --> 00:22:48,476
Rust doesn't have a idea
of what C++ objects are.
398
00:22:48,476 --> 00:22:53,586
So you get a void star or you get a
pointer, just a, an address and memory.
399
00:22:54,366 --> 00:22:58,726
And so when you wanna call back
into C++, you just pass that
400
00:22:58,746 --> 00:23:01,596
pointer back and hopefully it does
the right thing and then do that.
401
00:23:01,596 --> 00:23:04,656
But it's not just for the object, it's
for any argument, for any return type.
402
00:23:05,076 --> 00:23:08,646
All this is going through some
like void stars under the hood.
403
00:23:09,006 --> 00:23:13,656
But I ideally you want to be better
than what we did with that project,
404
00:23:13,656 --> 00:23:16,506
which is using like cbindgen, you want
to have something which is richer.
405
00:23:17,031 --> 00:23:21,011
And get this kind of interop
working between C++ and
406
00:23:21,011 --> 00:23:22,281
Rust in a more seamless way.
407
00:23:22,761 --> 00:23:26,541
And so a lot of my work has
been how do we make this happen?
408
00:23:26,701 --> 00:23:27,841
And how do we get this to work?
409
00:23:27,841 --> 00:23:31,116
And I can go very deep into that
subject if you're interested, if...
410
00:23:31,816 --> 00:23:36,346
Hit me because the this is something
that lots of people are thinking
411
00:23:36,386 --> 00:23:39,921
a lot about, and if you wanna
share, they would love to listen.
412
00:23:40,921 --> 00:23:41,311
Sure.
413
00:23:41,411 --> 00:23:42,521
So to start out,
414
00:23:42,621 --> 00:23:46,821
the model of objects is very
different between C++ and Rust.
415
00:23:46,871 --> 00:23:53,741
If you have a Rust object at some
place in memory, you can always just
416
00:23:53,891 --> 00:23:56,861
copy the bites from that place in
memory to another place in memory.
417
00:23:57,161 --> 00:24:01,391
And that effectively moves the object and
the object is valid in this other spot.
418
00:24:01,841 --> 00:24:05,501
So if you do assignment in
rust, like A equals B, um.
419
00:24:05,801 --> 00:24:10,241
You know, it, the, the way to think about
it is, is basically taking the memory that
420
00:24:10,391 --> 00:24:14,561
or b was pointing to and, and make that
the memory, the A is pointing to, right?
421
00:24:14,561 --> 00:24:16,091
It's just moving the memory around.
422
00:24:16,821 --> 00:24:25,361
Um, so in, in C++ that's not how things
work in general, if you have a, an object,
423
00:24:26,201 --> 00:24:30,461
like let's say you have a, a, a stu list,
like a link list or something along these
424
00:24:30,461 --> 00:24:34,181
lines, and the stu list is implemented
this way, uh, in, in many compilers.
425
00:24:34,251 --> 00:24:35,091
Oh, there is another,
426
00:24:35,541 --> 00:24:36,261
lists.
427
00:24:36,641 --> 00:24:40,141
because obviously in C++ we've
got, we don't have one compiler.
428
00:24:40,321 --> 00:24:44,341
We have a standard which is
implemented by many vendors
429
00:24:46,251 --> 00:24:49,401
yeah, and in this case the standard
library, the implementation of
430
00:24:49,401 --> 00:24:50,961
standard lists is different.
431
00:24:50,961 --> 00:24:54,341
Now, one, one implementation that
Microsoft has I dunno if they
432
00:24:54,341 --> 00:24:58,001
still have it, but they had for
years, is that the end node of
433
00:24:58,001 --> 00:25:02,951
the list is in the class itself.
434
00:25:03,821 --> 00:25:07,251
So you create a stud list the
end nodes in the class itself.
435
00:25:07,251 --> 00:25:09,621
It doesn't have to allocate when you
first create a stud list because it
436
00:25:09,621 --> 00:25:14,541
just has the start node, pointer point
to an object in the class itself.
437
00:25:15,201 --> 00:25:19,911
Now the problem is if you take the
memory of a stud list and you just put
438
00:25:19,911 --> 00:25:24,451
it to a different location and say,
okay, now the object's over there, that
439
00:25:24,451 --> 00:25:29,671
end Noe is now pointing back to where
the original stood list was, right?
440
00:25:30,241 --> 00:25:33,656
So you don't actually have a
well-defined object if you just
441
00:25:33,656 --> 00:25:35,306
copy the memory to somewhere else.
442
00:25:35,636 --> 00:25:39,946
The way that you move things in C++
is through a like a move constructor
443
00:25:39,946 --> 00:25:44,806
or a move assignment operator, where
you by hand say how to create the
444
00:25:44,806 --> 00:25:47,596
object in the new location, which
is equivalent to the old location.
445
00:25:47,926 --> 00:25:50,806
And that works totally fine with the
stood list example, because you just.
446
00:25:51,151 --> 00:25:52,861
Update that end node to the right spot.
447
00:25:53,431 --> 00:25:57,031
But this mis mismatch turns out
to be a really big deal when
448
00:25:57,031 --> 00:26:01,131
you want to interact with Rust,
because everything in Rust is mem-
449
00:26:01,231 --> 00:26:05,021
Just copy the memory from one place to
another, and if you put a C++ object in
450
00:26:05,021 --> 00:26:08,461
Rust and you just assign it to something
else, now all of a sudden you cata
451
00:26:10,051 --> 00:26:11,821
catastrophically broke your objects.
452
00:26:12,751 --> 00:26:17,461
And so that, that's like a major problem.
453
00:26:17,461 --> 00:26:21,901
If you want to be able to talk about C++
objects when you're operating within Rust.
454
00:26:22,906 --> 00:26:23,386
Wow.
455
00:26:23,446 --> 00:26:25,876
Yeah, no, that makes a lot of sense.
456
00:26:25,876 --> 00:26:30,886
And it's a pretty gnarly problem
because you've got essentially two
457
00:26:30,886 --> 00:26:36,446
worldviews and that, and I was thinking,
oh, couldn't you just overload the
458
00:26:36,446 --> 00:26:42,506
copy trait for particular bits and
pieces, but then not really no.
459
00:26:42,556 --> 00:26:43,366
That sounds tricky.
460
00:26:44,366 --> 00:26:47,516
It's very tricky because Rust
gives you this guarantee.
461
00:26:47,906 --> 00:26:53,276
A bunch of generic code is out
there, which will directly mem copy
462
00:26:53,276 --> 00:26:56,186
things around, and that's totally
463
00:26:56,186 --> 00:26:57,716
valid for every type that you give it.
464
00:26:58,766 --> 00:27:01,616
And so what do you do?
465
00:27:01,856 --> 00:27:04,096
So like the ways that people
have been working around this
466
00:27:04,096 --> 00:27:06,066
issue one is through pinning.
467
00:27:06,696 --> 00:27:10,836
So if you pin and type in Rust
or an object in Rust, you're
468
00:27:10,836 --> 00:27:15,096
basically saying this object cannot
move from this piece of memory.
469
00:27:15,936 --> 00:27:17,946
So assignment and all this
kind of stuff just doesn't work
470
00:27:17,946 --> 00:27:19,246
with that as you would expect.
471
00:27:19,306 --> 00:27:20,386
'cause it's just pinned in memory.
472
00:27:20,746 --> 00:27:25,456
And if you use a pinned
interface, the drawback is it's
473
00:27:25,456 --> 00:27:27,526
very not ergonomic and Rust.
474
00:27:27,616 --> 00:27:31,096
It's like you work with a pinned object,
you're just like, oh, great, now I'm
475
00:27:31,096 --> 00:27:34,966
gonna have a bad day because this is just
not friendly, good rust code anymore.
476
00:27:35,456 --> 00:27:40,376
And so the CXX crate, which
is one, one way to do C++ Rust
477
00:27:40,376 --> 00:27:42,306
in a wrap follows this method.
478
00:27:42,396 --> 00:27:44,466
And then you have to deal
with that as a drawback.
479
00:27:45,006 --> 00:27:50,526
Another option, and this is what
Zengar does, so Zengar, Z-N-G-U-R,
480
00:27:50,736 --> 00:27:52,446
it's not very well known yet.
481
00:27:52,446 --> 00:27:55,416
I'm trying to get more awareness to
this c plus interop solution 'cause
482
00:27:55,416 --> 00:27:56,956
it's it's very good in many ways.
483
00:27:57,196 --> 00:28:01,126
But anyway, Zengar, what they
do is they say, okay, we will.
484
00:28:01,456 --> 00:28:04,526
Just allocate every time
we create a C++ object.
485
00:28:04,546 --> 00:28:06,856
So it always creates a
C++ object on the heap.
486
00:28:07,756 --> 00:28:10,546
And that way when things are
assigned, you're just copying
487
00:28:10,546 --> 00:28:12,326
that pointer, back and forth.
488
00:28:12,326 --> 00:28:14,216
But then you're paying a
heap allocation, right?
489
00:28:14,216 --> 00:28:16,406
And that we lose our
high performance there.
490
00:28:16,856 --> 00:28:17,366
At least.
491
00:28:17,366 --> 00:28:17,786
At least.
492
00:28:17,876 --> 00:28:18,056
Yeah.
493
00:28:18,086 --> 00:28:18,306
So
494
00:28:18,311 --> 00:28:22,801
just, and this may, this is probably
obvious to most, but I'll just
495
00:28:22,801 --> 00:28:27,091
reiterate it for my own ignorance
perhaps, but mem copy is a ridiculously
496
00:28:27,091 --> 00:28:31,291
trick, which I like sub, like
single digit cycles time probably.
497
00:28:31,651 --> 00:28:37,171
Whereas, and so this is, a millionth
of a second a nanosecond scale.
498
00:28:37,501 --> 00:28:44,451
And then a heap allocation, is anywhere,
10 to a hundred and 150, let's say.
499
00:28:44,501 --> 00:28:48,451
It's it's a lot of time if you're
creating a lot of objects or if
500
00:28:48,451 --> 00:28:51,331
you're just doing assignment a lot
like sort of updates and you have
501
00:28:51,331 --> 00:28:52,711
to pay that cost every single time.
502
00:28:53,131 --> 00:28:54,871
That would be annoying.
503
00:28:55,226 --> 00:28:57,451
Y Yeah.
504
00:28:57,511 --> 00:28:58,921
If I recall correctly, it's a thousand
505
00:28:58,921 --> 00:29:00,271
times slower.
506
00:29:00,511 --> 00:29:03,241
So it's a substantial thing, especially
if you get a vector of these things.
507
00:29:03,721 --> 00:29:05,991
Now you pay that for, big ON,
508
00:29:06,291 --> 00:29:10,826
Yeah, although references I guess which
are just pointers really can, obviously
509
00:29:10,826 --> 00:29:15,566
they're just the, in the rust world or
we call this like the U size or the size
510
00:29:15,566 --> 00:29:18,446
of the bits of the SCPU architecture.
511
00:29:18,926 --> 00:29:21,146
They're instantaneous
to copy around anyway.
512
00:29:21,146 --> 00:29:25,076
So this is a, one of the advantages
of like plunking things on the heap.
513
00:29:25,436 --> 00:29:29,366
You pay, you amortize the cost
of that allocation once because
514
00:29:29,366 --> 00:29:32,756
you can now mem copy as many
times as you require later on.
515
00:29:33,756 --> 00:29:33,976
Yes.
516
00:29:34,461 --> 00:29:34,731
Yep.
517
00:29:36,591 --> 00:29:43,161
Um, so there was a new feature
that got added to C++ 26.
518
00:29:43,231 --> 00:29:46,781
We're in 25, so it hasn't come out
yet, but it's in the latest C++ draft,
519
00:29:47,611 --> 00:29:51,411
um, called Trivial Relocateability.
520
00:29:52,731 --> 00:29:56,811
And what this does is it identifies.
521
00:29:57,361 --> 00:30:03,981
The types in C++ to a rough approximation,
that can be me copied around because
522
00:30:03,981 --> 00:30:08,661
it turns out that stood list example,
like that's, that's an outlier.
523
00:30:08,781 --> 00:30:13,221
Most things like a Stu Vector, most
classes that you would write, you
524
00:30:13,221 --> 00:30:16,761
could actually just move the memory
to new location and it would work.
525
00:30:16,761 --> 00:30:17,031
Okay.
526
00:30:17,031 --> 00:30:20,701
It's technically undefined behavior, but
it works because that's just how it is.
527
00:30:21,241 --> 00:30:27,211
So the idea behind Trivial Relocateability
was to see if there's a way to make
528
00:30:27,211 --> 00:30:31,711
this carve out of types that support
this and make that defined behavior.
529
00:30:32,881 --> 00:30:37,251
And so the thought was, oh, okay then
maybe any type, which is trivially
530
00:30:37,251 --> 00:30:43,741
relocatable in C++ 26, we can put this
on the rust stack and do stuff with it.
531
00:30:44,671 --> 00:30:45,091
If
532
00:30:45,266 --> 00:30:47,186
did note that this was in the past tense.
533
00:30:48,186 --> 00:30:48,576
Yeah.
534
00:30:49,536 --> 00:30:54,876
The problem was there's a new architecture
that Apple's coming out with is called
535
00:30:54,876 --> 00:31:03,556
ARM 64 E, and it's a security a BI change
primarily created for security purposes.
536
00:31:04,246 --> 00:31:09,806
And what they did is you, if you have
a polymorphic type in C++, so something
537
00:31:09,806 --> 00:31:14,026
that inherits from something with a
virtual function, um, that needs to have
538
00:31:14,026 --> 00:31:17,776
a V table in C++ to, to, in case you
cast it to a base class, you need to
539
00:31:17,776 --> 00:31:19,486
point to the right function and so on.
540
00:31:20,056 --> 00:31:25,946
And so there's a pointer in every
polymorphic object to the V table, right?
541
00:31:26,336 --> 00:31:28,286
And this pointer is transparent to users.
542
00:31:28,286 --> 00:31:30,266
You don't actually see that
it's there or whatever.
543
00:31:30,686 --> 00:31:34,886
Me copying objects with a V
table is totally fine up until.
544
00:31:35,616 --> 00:31:41,146
Arm 64 E. And what they did for
security purposes is they said, look,
545
00:31:42,406 --> 00:31:47,656
the V table pointer is a great way
for hackers to, to own your process
546
00:31:47,656 --> 00:31:51,836
because they can just take that
pointer and point it to their own code.
547
00:31:51,866 --> 00:31:55,496
And next time you call a virtual function,
you're going into the attacker's code.
548
00:31:56,096 --> 00:32:00,776
So they said what we're gonna do is we're
gonna take the V table pointer and use
549
00:32:00,776 --> 00:32:03,986
some of the extra bits in it because
nobody actually has two to the 64 memory.
550
00:32:03,986 --> 00:32:09,836
So they're gonna use these upper level
bits and add some data in there that ties
551
00:32:09,986 --> 00:32:18,296
that V table pointer to the object, which
contains the V table pointer, right?
552
00:32:18,836 --> 00:32:22,976
So that way if an attacker changes the
VT pointer to something else, if it
553
00:32:22,976 --> 00:32:27,086
tries to execute that V table pointer,
it'll be like, Nope, can't do that.
554
00:32:27,326 --> 00:32:28,646
You lost the signature, which
555
00:32:28,841 --> 00:32:34,851
So the CPU will essentially fault
because the yeah we've, it, I'm
556
00:32:34,851 --> 00:32:36,411
just going to use naive link.
557
00:32:36,411 --> 00:32:40,731
Maybe this isn't, but it sounds a lot like
a capabilities model where the original
558
00:32:40,881 --> 00:32:44,971
or some sort of providence back to the
original memory address, let's say.
559
00:32:45,511 --> 00:32:50,401
And if you Yeah, change the
destination, those parity bits won't
560
00:32:50,911 --> 00:32:55,621
work and therefore, or let some
sort of checks sum, and then, oh.
561
00:32:57,321 --> 00:33:01,881
Your program will crash, which is
probably better than having some un
562
00:33:01,911 --> 00:33:06,171
foreign code execute until you want to do
563
00:33:06,171 --> 00:33:09,051
something fun like interrupt with rust.
564
00:33:10,051 --> 00:33:10,381
Yep.
565
00:33:10,451 --> 00:33:11,041
Exactly.
566
00:33:11,621 --> 00:33:16,051
And so in the C++ world, they solve
this problem by saying, okay instead
567
00:33:16,051 --> 00:33:19,051
of saying, you can mem copy all
these types to move them around,
568
00:33:19,531 --> 00:33:24,331
you can call this trivially relocate
function and that will do it for you.
569
00:33:24,781 --> 00:33:27,511
You trivially relocate, it does
the mem copy and it does all the V
570
00:33:27,511 --> 00:33:32,201
table pointer fix ups, and that's
all fine and dandy in the C++ world.
571
00:33:32,221 --> 00:33:36,691
But now you go back to the Rust
interop, Rust isn't gonna do any
572
00:33:36,691 --> 00:33:38,311
vtable pointer fix ups for you, right?
573
00:33:38,311 --> 00:33:40,201
It's literally copying the memory.
574
00:33:40,841 --> 00:33:44,441
And so that kind of broke that idea.
575
00:33:44,951 --> 00:33:51,441
And so what we're trying to do now
is add a new feature to C++, and
576
00:33:51,611 --> 00:33:53,821
this is primarily for Rust interop.
577
00:33:54,481 --> 00:34:00,691
And what this will do is instead of having
the primitive copy thing from location
578
00:34:00,691 --> 00:34:04,711
A to location B, and then do the V two
table pointer, fix up, it's going to
579
00:34:05,461 --> 00:34:07,471
get a pointer to where it used to live.
580
00:34:08,581 --> 00:34:12,631
And a pointer to the current
location and do the fix up that way.
581
00:34:12,631 --> 00:34:16,411
So, essentially separating the movement
of the memory from the point, the v
582
00:34:16,411 --> 00:34:19,741
table pointer, fix ups, if you have that.
583
00:34:20,821 --> 00:34:25,271
Then on the rust side, if you
get an object, and this is
584
00:34:25,271 --> 00:34:26,621
hard to explain it, a podcast
585
00:34:26,856 --> 00:34:27,236
yeah.
586
00:34:27,401 --> 00:34:28,031
I'll do my best.
587
00:34:28,376 --> 00:34:29,186
It's not the best,
588
00:34:29,546 --> 00:34:29,816
not
589
00:34:29,876 --> 00:34:31,556
it's not the universal medium, let's say.
590
00:34:33,491 --> 00:34:34,871
Yes.
591
00:34:34,941 --> 00:34:40,581
You create your object on the, your
c plus object on the rust stack.
592
00:34:40,701 --> 00:34:44,931
But you add a little bit at the
end, which is enough for a pointer.
593
00:34:46,191 --> 00:34:49,611
And so when you initially create the
object, you have all your data for
594
00:34:49,611 --> 00:34:53,481
the object and you have a pointer,
which is just happens to be set
595
00:34:53,481 --> 00:34:55,431
to where the object's location is.
596
00:34:56,541 --> 00:34:59,451
Now on the rest side, you can
assign, you can move things around.
597
00:34:59,451 --> 00:35:01,881
Now the object is in some
other location somewhere else.
598
00:35:02,346 --> 00:35:07,566
And that pointer is still set to the
original place that object lived.
599
00:35:08,166 --> 00:35:11,346
The data for that object is the data
that we're what it used to be, but
600
00:35:11,346 --> 00:35:13,716
it's just in a new location now.
601
00:35:13,716 --> 00:35:18,156
When you call a c plus function, you
need to make sure this is all fixed up.
602
00:35:19,296 --> 00:35:23,106
So when you call your intermediate C
layer, which eventually calls your C
603
00:35:23,106 --> 00:35:27,576
function, that intermediate C layer will
call that special new function that got
604
00:35:27,576 --> 00:35:31,236
added to the standard, which says, Hey,
here's the pointer to the old location.
605
00:35:31,236 --> 00:35:32,766
Here's the data at the new location.
606
00:35:33,156 --> 00:35:36,216
It'll fix up all the pointers
for you, and now it's valid.
607
00:35:36,246 --> 00:35:39,456
And define behavior to call that c
plus function that you were calling.
608
00:35:40,521 --> 00:35:42,091
That sounds innovative.
609
00:35:42,301 --> 00:35:42,811
Well done.
610
00:35:43,231 --> 00:35:45,251
It's have you unlocked the puzzle?
611
00:35:45,461 --> 00:35:46,781
Have you solved the puzzle, do you think?
612
00:35:46,841 --> 00:35:47,831
Or at least
613
00:35:48,831 --> 00:35:49,551
I, think.
614
00:35:50,436 --> 00:35:50,826
okay.
615
00:35:50,841 --> 00:35:53,941
we may have, there are still some
open questions on how to deal
616
00:35:53,941 --> 00:35:58,931
with this on the rust side because
that works fine and dandy for, uh,
617
00:35:58,961 --> 00:36:01,011
C++ objects you create in Rust.
618
00:36:01,321 --> 00:36:05,171
But what if C++ gives you an object or
a reference to one of those objects?
619
00:36:05,171 --> 00:36:06,731
Now that one doesn't have the little
620
00:36:06,791 --> 00:36:10,451
space at the end with the pointer,
so that might be a different type.
621
00:36:10,496 --> 00:36:12,836
You might want to convert it to one
with the pointer thing at the end.
622
00:36:12,836 --> 00:36:13,286
I don't know.
623
00:36:13,286 --> 00:36:14,699
There, there's some, some thought
624
00:36:14,699 --> 00:36:22,398
So if I was a, although but yeah, no
that, that seems like a decent enough
625
00:36:22,398 --> 00:36:28,768
chunk of the problem to be a good step
forward because I presume that if I was
626
00:36:28,768 --> 00:36:34,708
importing a C library, sorry, c plus
library from rust, most of the time I
627
00:36:34,708 --> 00:36:40,708
would be initializing the objects rather
than essentially receiving an object
628
00:36:40,708 --> 00:36:43,618
that was created in the library itself.
629
00:36:43,768 --> 00:36:45,718
So no, that's really interesting.
630
00:36:46,168 --> 00:36:48,238
How does it change like that happen?
631
00:36:49,048 --> 00:36:49,918
It must be.
632
00:36:51,173 --> 00:36:53,543
This is a little bit about how
the committee works, but there
633
00:36:53,543 --> 00:36:59,353
must be years of deliberation for
things like this to make progress.
634
00:37:00,353 --> 00:37:07,343
With the committee there's a lot of
formalisms and structure and all these
635
00:37:07,343 --> 00:37:11,083
kinds of things, people frequently get
defeated by it because it's just like
636
00:37:11,113 --> 00:37:12,463
too overwhelming, too complicated.
637
00:37:12,463 --> 00:37:15,763
But if you understand it, there
are tricks that you can do.
638
00:37:16,303 --> 00:37:18,863
So here's the trick that we're
gonna do or we're gonna attempt,
639
00:37:18,863 --> 00:37:20,123
we'll see if it actually works.
640
00:37:20,153 --> 00:37:23,763
So right now, no new features
are allowed for C++ 26,
641
00:37:24,173 --> 00:37:24,443
right?
642
00:37:24,443 --> 00:37:25,733
It's already been stamped.
643
00:37:25,943 --> 00:37:27,143
It's going out to the national
644
00:37:27,143 --> 00:37:29,393
bodies for ballot at this point.
645
00:37:29,793 --> 00:37:32,613
And now we deal with what's
called National body comments.
646
00:37:33,543 --> 00:37:36,753
So every national body can say,
okay, we released this, we got
647
00:37:36,753 --> 00:37:39,813
this spec, and we have a comment
about this, a comment about this.
648
00:37:39,843 --> 00:37:42,603
And these are usually
comments about bug fixes.
649
00:37:42,603 --> 00:37:45,093
You can never say add a
new feature with a comment.
650
00:37:45,903 --> 00:37:49,793
And and this is a new feature in c
plus 26 is trivially relocatable thing.
651
00:37:50,363 --> 00:37:53,608
And so what I'm planning on
doing is making a national body
652
00:37:53,608 --> 00:37:58,708
comment for the us, which says
that we got our primitive wrong.
653
00:37:59,248 --> 00:38:04,048
The trivially relocate function is not
actually the simplest way to express
654
00:38:04,048 --> 00:38:08,348
this primitive like basis operation
for trivially relocatable types.
655
00:38:08,918 --> 00:38:11,558
It's this other thing, which
is called start lifetime.
656
00:38:11,558 --> 00:38:18,848
At and through this bug fixing
process, I'm hopeful we'll be able
657
00:38:18,848 --> 00:38:20,918
to say, oh yeah, that was a mistake.
658
00:38:21,188 --> 00:38:25,688
And so before se LS plus 26 ships,
we're going to have this new basis
659
00:38:25,688 --> 00:38:30,158
operation and that will unlock this
rust interop thing, but also solves
660
00:38:30,158 --> 00:38:32,678
another problem that people had
with the feature, which was that
661
00:38:32,978 --> 00:38:36,248
it didn't work with re alec where
you basically have an existing buffer
662
00:38:36,248 --> 00:38:39,038
that you're expanding and sometimes
it can expand at the same place.
663
00:38:39,398 --> 00:38:44,178
So I'm hopeful that we can get this to
happen, but yeah we're using this national
664
00:38:44,178 --> 00:38:46,068
body comment process to, to slip it in.
665
00:38:46,308 --> 00:38:48,533
Otherwise we're gonna
have to wait for C++ 29.
666
00:38:50,013 --> 00:38:50,883
I am curious.
667
00:38:50,883 --> 00:38:51,483
I'll watch.
668
00:38:51,513 --> 00:38:54,723
I think it'll be fascinating because
especially it's almost, there's always
669
00:38:54,723 --> 00:39:00,843
a meta discussion as well, but the
committee processes are challenging.
670
00:39:00,873 --> 00:39:05,763
A lot of people don't really have,
the stamina or it, 'cause everyone
671
00:39:05,763 --> 00:39:09,063
is so emotionally involved because
they wouldn't be there if they
672
00:39:09,063 --> 00:39:13,483
didn't think that things
could move forward or improve.
673
00:39:14,173 --> 00:39:16,843
And they've got this great idea that
they've been working on for years.
674
00:39:16,843 --> 00:39:21,133
They have a working implementation
before they even start proposing it.
675
00:39:22,123 --> 00:39:23,743
And now you're telling me
you gotta, I gotta wait.
676
00:39:23,743 --> 00:39:26,203
Like I gotta get, it's, yeah.
677
00:39:26,203 --> 00:39:28,208
I can just imagine that if I was.
678
00:39:28,733 --> 00:39:32,243
Doing this out of love or something
that there's no way I would
679
00:39:32,243 --> 00:39:36,593
be able to last a five to 10
years to get new things through.
680
00:39:36,623 --> 00:39:41,453
I was looking at one time, or I
think it was concepts, how there were
681
00:39:41,453 --> 00:39:47,063
multiple implementations and different
ideas about the way that could work.
682
00:39:47,063 --> 00:39:53,483
And but then again for something as
impactful as making a change to one
683
00:39:53,483 --> 00:39:56,663
of the most fundamental programming
languages in the world maybe
684
00:39:56,663 --> 00:39:59,093
waiting five years isn't very long.
685
00:39:59,098 --> 00:40:03,898
Like, I mean, uh, C++
is, um, is everywhere.
686
00:40:04,133 --> 00:40:07,703
And so it's extremely fundamental
and it's extremely important.
687
00:40:07,703 --> 00:40:12,653
The stakes are very, very high, and
so it makes sense to take things slow.
688
00:40:15,398 --> 00:40:16,253
I, I think so.
689
00:40:16,253 --> 00:40:20,603
And I think that's one of its
particular charisms is that.
690
00:40:21,038 --> 00:40:24,698
It is generally a slow moving
language, not as slow as C
691
00:40:24,818 --> 00:40:26,228
although C is speeding up.
692
00:40:26,468 --> 00:40:28,928
But you only can take on so
much new stuff at a time.
693
00:40:28,928 --> 00:40:34,298
And I think actually in my opinion, c
plus has grown too fast for its own good.
694
00:40:34,898 --> 00:40:37,628
We've hit some kind of tipping point
to where the complexity is more of
695
00:40:37,628 --> 00:40:39,488
a problem than it was a solution.
696
00:40:40,008 --> 00:40:42,018
And I don't know how to reverse that
697
00:40:42,128 --> 00:40:45,688
I think may maybe, human bias or
something, but it's much easier to add
698
00:40:45,688 --> 00:40:50,628
an extra feature, like an extra box to
the checklist or like the feature list.
699
00:40:50,838 --> 00:40:56,103
But, taking things away
is really is much harder.
700
00:40:57,043 --> 00:40:59,133
Just imagine saying,
actually we'll cut that out.
701
00:40:59,433 --> 00:41:00,693
Is essentially impossible.
702
00:41:00,793 --> 00:41:05,823
More generally than C++, but it's like
any sort of product, for example, software
703
00:41:05,823 --> 00:41:11,373
things, software products in general, I
think have this tendency to grow until
704
00:41:11,373 --> 00:41:12,468
they collapse under their own weight.
705
00:41:13,468 --> 00:41:14,518
Yeah, I think so.
706
00:41:14,578 --> 00:41:18,128
Also if you look at it from like
a company perspective let's say
707
00:41:18,128 --> 00:41:20,078
you've got a huge code base.
708
00:41:20,078 --> 00:41:22,913
I think the last quote I got
from Photoshop was like 79
709
00:41:22,913 --> 00:41:24,008
million lines of code, right?
710
00:41:24,008 --> 00:41:28,238
So we're talking a lot of code and
somebody from a standardization body
711
00:41:28,238 --> 00:41:33,718
says, Hey, you need to change, a
million lines of your code because we
712
00:41:33,718 --> 00:41:34,978
found a better way to do something.
713
00:41:36,298 --> 00:41:40,228
And the response is does that
add any value to my product?
714
00:41:40,473 --> 00:41:41,533
Do the customers care?
715
00:41:42,003 --> 00:41:42,663
no, not really.
716
00:41:43,943 --> 00:41:44,233
Yeah.
717
00:41:45,578 --> 00:41:48,878
Okay, so somebody up in the ivory tower
has decided there's a better way to
718
00:41:48,878 --> 00:41:52,868
do something and now I have to pay a
buttload of money for, that's not gonna
719
00:41:52,868 --> 00:41:54,368
actually have any tangible benefit.
720
00:41:54,938 --> 00:41:55,388
Nah.
721
00:41:55,988 --> 00:41:57,698
Rather keep the existing code.
722
00:41:57,698 --> 00:42:00,058
You wanna do something new
with the new codewe right?
723
00:42:00,248 --> 00:42:00,788
Great.
724
00:42:00,788 --> 00:42:05,768
But like that old code, if it's working
and it's doing its job like please don't
725
00:42:05,768 --> 00:42:06,968
make me have to do anything with it.
726
00:42:06,968 --> 00:42:07,178
'cause the
727
00:42:07,178 --> 00:42:08,198
scale is too big.
728
00:42:08,508 --> 00:42:09,828
It is just way too much.
729
00:42:11,718 --> 00:42:20,168
Are there any lessons for individuals that
you think if, who are navigating, while we
730
00:42:20,168 --> 00:42:25,768
come we've talked about Rust language, C++
language, you know, companies, but what
731
00:42:25,768 --> 00:42:29,428
about, uh, people and their own careers?
732
00:42:29,958 --> 00:42:31,818
Yeah, I think that's a
really good question.
733
00:42:31,818 --> 00:42:36,908
I think I can speak in
particular for C++ developers.
734
00:42:37,458 --> 00:42:40,508
For someone who's a C++ developer,
they're an expert in it.
735
00:42:40,568 --> 00:42:42,398
You know, they feel very
powerful in that language.
736
00:42:42,398 --> 00:42:45,638
And the idea of going to any other
language, you'd feel very weakened, right?
737
00:42:45,638 --> 00:42:47,198
Because you're just so
used to this language.
738
00:42:47,598 --> 00:42:51,408
If you're a c plus developer
you have a choice, right?
739
00:42:51,678 --> 00:42:56,118
You will definitely, no matter what
stage of your career, be able to program
740
00:42:56,118 --> 00:42:57,408
c plus for the rest of your career.
741
00:42:57,658 --> 00:42:59,188
This is not going away.
742
00:42:59,548 --> 00:42:59,698
There.
743
00:42:59,818 --> 00:43:00,928
Jobs are gonna be there.
744
00:43:01,408 --> 00:43:06,688
But it will be with a legacy language,
especially towards the end of your career,
745
00:43:06,688 --> 00:43:10,618
it's gonna be like, there are some FORTRAN
people today and they do their thing.
746
00:43:10,618 --> 00:43:11,698
There are some COBOL people.
747
00:43:11,818 --> 00:43:16,318
I don't think it'll be that bad in 20
years, but it'll be in that space, right?
748
00:43:16,918 --> 00:43:19,738
But just be okay with that if
that's what you want to do.
749
00:43:20,458 --> 00:43:22,918
If you're looking, if you wanna be.
750
00:43:24,073 --> 00:43:28,603
Where the innovation is happening,
then you're gonna have to take a
751
00:43:28,603 --> 00:43:31,783
different approach and you're gonna
have to look at things like Rust
752
00:43:31,843 --> 00:43:34,603
and Rust in particular right now, I
think is really important to look at.
753
00:43:35,083 --> 00:43:36,253
And don't be threatened by it.
754
00:43:36,703 --> 00:43:42,463
See, I, something that's not talked about
a lot is that rust is an outgrowth of C++.
755
00:43:42,933 --> 00:43:45,133
C++ is almost its granddaddy.
756
00:43:45,133 --> 00:43:47,053
People hate it when I
say that, but it's true.
757
00:43:47,503 --> 00:43:52,153
So many lessons that were learned
from C++ were incorporated in a rust,
758
00:43:52,153 --> 00:43:55,153
whether it's acknowledged or not,
it's just obvious in the design.
759
00:43:55,663 --> 00:44:01,033
And if you look at it like that,
it's, you can be proud of it, right?
760
00:44:01,113 --> 00:44:01,583
You're a C++.
761
00:44:02,023 --> 00:44:03,373
Look at all the stuff that
they learned from C++.
762
00:44:03,783 --> 00:44:04,513
That's great.
763
00:44:04,513 --> 00:44:07,943
All the stuff that I did to
help grow C++ or, or build C++
764
00:44:08,323 --> 00:44:10,873
knowledge in the community of
people that I'm, I'm, I'm with.
765
00:44:11,503 --> 00:44:13,483
This is a consequence of that.
766
00:44:13,483 --> 00:44:14,504
It's a benefit of it.
767
00:44:15,223 --> 00:44:17,053
And if you look at it like
that, it's not as threatening.
768
00:44:17,053 --> 00:44:18,373
It's not like an us versus them.
769
00:44:18,373 --> 00:44:19,153
It's more like.
770
00:44:19,528 --> 00:44:20,548
You know, good for them.
771
00:44:20,668 --> 00:44:24,018
You know, like, let me look into this
because this is the next step in C++'s
772
00:44:24,508 --> 00:44:28,948
growth is actually Rust it's the, you
wouldn't say next step in C++'s growth,
773
00:44:28,948 --> 00:44:33,508
but next step in growth for a systems
engineer is using the latest tech.
774
00:44:33,888 --> 00:44:35,448
And the same is true for AI, right?
775
00:44:35,448 --> 00:44:38,538
It's like another one of these
things is it's gonna be here, right?
776
00:44:38,538 --> 00:44:41,298
You're not gonna change
it and make it go away.
777
00:44:41,748 --> 00:44:45,928
But you can be part of the future
and what it's going to bring.
778
00:44:45,928 --> 00:44:50,098
And so I would recommend to
people to be open-minded about it.
779
00:44:50,198 --> 00:44:52,178
Check it out, try it in a real project.
780
00:44:52,398 --> 00:44:55,548
You want to seek that feeling
that so many people report that.
781
00:44:55,548 --> 00:44:59,388
Oh, I went and I used rust and I really
don't wanna use c plus anymore after that.
782
00:44:59,778 --> 00:45:01,458
You wanna seek that experience, right?
783
00:45:01,458 --> 00:45:03,798
Because then you can get it and you
can see where they're coming from
784
00:45:03,858 --> 00:45:05,438
and then, see where that takes you.
785
00:45:05,513 --> 00:45:07,463
But you gotta be open-minded, right?
786
00:45:07,463 --> 00:45:10,693
It's just gonna, you're gonna have to
try out some things and get past some
787
00:45:10,693 --> 00:45:13,093
biases and just say like, all right,
I'm gonna, I'm gonna give it a whirl.
788
00:45:13,458 --> 00:45:16,193
I think of Rust as a bit of
a spiritual successor to C++.
789
00:45:17,463 --> 00:45:25,628
The one funny thing actually is and
Rust has learned so much from systems
790
00:45:25,628 --> 00:45:32,838
programming experience over over several
decades, and it's as though we have
791
00:45:32,838 --> 00:45:37,688
taken the lessons around initialization
and destruction and just encoded that
792
00:45:37,688 --> 00:45:40,298
in the type system or into the compiler.
793
00:45:40,688 --> 00:45:44,558
There is this liberating feeling,
knowing that you are never going
794
00:45:44,558 --> 00:45:50,858
to need to worry about, I don't
know, deleting an object twice.
795
00:45:52,178 --> 00:45:57,638
It's just, oh, that's not a, that's not
a concern that I need to have perhaps.
796
00:45:57,638 --> 00:46:00,228
But another thing is maybe they front
load the concern because you know
797
00:46:00,228 --> 00:46:04,548
your design needs to be correct, but
also, isn't it so much better that
798
00:46:04,548 --> 00:46:09,858
you get told that there's a problem
early before you get told by your users
799
00:46:09,858 --> 00:46:13,338
that there's a problem or worse they
don't tell you 'cause they don't know.
800
00:46:13,338 --> 00:46:17,958
And they've got introduced some sort of
horrendous bug by the way that a lot of
801
00:46:17,958 --> 00:46:20,958
that stuff around C++ was accidental.
802
00:46:22,053 --> 00:46:25,543
I don't, I am not gonna be able to
find the reference, but grad whore
803
00:46:25,543 --> 00:46:31,543
is was talking I think it might have
been on Twitter that or saying that
804
00:46:31,543 --> 00:46:33,343
was not the original intent with Rust.
805
00:46:33,973 --> 00:46:38,293
The original intent was something
much more closer to go where you
806
00:46:38,353 --> 00:46:44,383
or I guess much more with a much
greater focus on concurrency.
807
00:46:45,463 --> 00:46:51,353
But then when it was adopted by
Mozilla, the Firefox group really
808
00:46:51,353 --> 00:46:57,723
wanted to essentially be zero cost
abstractions all the way down and had
809
00:46:57,723 --> 00:47:04,743
this very heavy, practical focus on
being as lean at runtime as possible.
810
00:47:05,373 --> 00:47:07,323
Because if Rust was to ever compete.
811
00:47:08,268 --> 00:47:11,228
It needed to be able it needed to shed.
812
00:47:11,228 --> 00:47:16,288
Its its runtime, which it had at one, very
pre 1.0 like it's now over a decade ago.
813
00:47:16,348 --> 00:47:21,988
But it's a slight accident of history,
but also really positive that the
814
00:47:21,988 --> 00:47:24,718
language was incubated in production.
815
00:47:26,548 --> 00:47:30,298
The idea that we could, we were
creating a programming language to
816
00:47:30,298 --> 00:47:38,068
be able to work in the context of a
c plus program to enable multi-core.
817
00:47:38,428 --> 00:47:41,968
And that was a very, like a
multimillion lines of code
818
00:47:41,968 --> 00:47:45,698
base with built by many teams.
819
00:47:45,698 --> 00:47:52,283
And so all of those features were
like part of, it's, part of it
820
00:47:52,288 --> 00:47:56,778
how, part of how it grew up out
of a hobby project originally.
821
00:47:57,858 --> 00:48:03,318
I think it would be like, this has just
been such a really nice arc all the way.
822
00:48:03,438 --> 00:48:05,868
And thank you so much for
sharing your thoughts.
823
00:48:05,868 --> 00:48:08,928
Has there been anything else that's
popped into your mind as we've
824
00:48:08,928 --> 00:48:13,398
been chatting that you're like, oh,
I should tell people about that?
825
00:48:14,398 --> 00:48:18,913
I guess probably the biggest thing is
check out Zengar for doing c plus interop.
826
00:48:19,303 --> 00:48:25,603
The, it's way less known than it
deserves as a c plus interop layer.
827
00:48:25,603 --> 00:48:26,683
Like very interesting.
828
00:48:27,103 --> 00:48:28,123
That's probably the biggest thing that
829
00:48:28,233 --> 00:48:28,523
Okay.
830
00:48:28,728 --> 00:48:29,208
Fantastic.
831
00:48:29,238 --> 00:48:32,598
I am so looking forward to your
talk in New Zealand next month.
832
00:48:32,598 --> 00:48:36,958
I am just, I feel so incredibly honored
that you have decided that you accepted
833
00:48:36,958 --> 00:48:39,718
our offer to, to come down here.
834
00:48:39,928 --> 00:48:41,488
And I hope that you have a very.
835
00:48:42,133 --> 00:48:44,473
Enjoyable experience in the country.
836
00:48:44,803 --> 00:48:50,173
Until then, I hope that you also actually
enjoy the process of preparing for a talk.
837
00:48:50,243 --> 00:48:54,713
I know that you'll have a very receptive
audience, so thank you both for sharing
838
00:48:54,713 --> 00:48:56,943
your time and sharing your expertise.
839
00:48:57,033 --> 00:48:57,663
So thanks, David.
840
00:48:58,663 --> 00:48:59,533
Oh, thank you so much.
841
00:48:59,533 --> 00:49:04,903
I am so psyched about the conference,
so I can't wait to be there.
00:00:03,106 --> 00:00:06,726
Welcome to Compose, a software
development podcast featuring
2
00:00:06,726 --> 00:00:10,056
the Rust programming language and
how it interacts with the world.
3
00:00:11,616 --> 00:00:18,486
This episode features interoperability
with C++ and how that might progress
4
00:00:18,516 --> 00:00:20,511
over the years and even decades ahead.
5
00:00:21,786 --> 00:00:24,486
To talk us through it all
is David Sankel from Adobe.
6
00:00:25,266 --> 00:00:28,816
David is an invited speaker at
this year's Rust Forge Conference.
7
00:00:29,536 --> 00:00:32,476
Rust Forge itself is happening
in Wellington, New Zealand, and
8
00:00:32,476 --> 00:00:33,826
you're still very welcome to come.
9
00:00:35,446 --> 00:00:38,566
For those of you who would even
like a discount, try visiting
10
00:00:38,876 --> 00:00:42,836
rustforgeconf.com/compose.
11
00:00:46,301 --> 00:00:48,781
I guess I'm at heart a a computer nerd.
12
00:00:48,901 --> 00:00:53,996
So I'm sitting here and in front of me is
like these little microprocessors, right?
13
00:00:53,996 --> 00:00:55,286
That I'm just programming for fun.
14
00:00:55,796 --> 00:00:59,076
But I guess who I am probably of
interest to this community, I am a
15
00:00:59,076 --> 00:01:03,996
principal scientist at Adobe and I
run Adobe Software Technology Lab.
16
00:01:04,416 --> 00:01:09,386
And that is a team which is focused on
what is going to be happening in the
17
00:01:09,386 --> 00:01:11,936
next 10 years with software development.
18
00:01:12,506 --> 00:01:15,896
And we're very much, our heads are in that
space and we have to figure out how we're
19
00:01:15,896 --> 00:01:18,116
gonna have Adobe align with that future.
20
00:01:18,146 --> 00:01:22,126
And also how can we help steer
the industry so that it can
21
00:01:22,126 --> 00:01:24,466
better support what's going
to be happening going forward.
22
00:01:24,466 --> 00:01:26,026
So that's my day job.
23
00:01:26,096 --> 00:01:30,476
And I'm also very involved in C++
Standardization committee, and now more
24
00:01:30,476 --> 00:01:34,936
recently involved in Rust and specifically
Rust Interop and doing that at Adobe.
25
00:01:34,936 --> 00:01:35,566
So that's
26
00:01:36,016 --> 00:01:38,631
I feel like for many people that
kind of sounds like a bit of
27
00:01:38,631 --> 00:01:40,561
a dream job, look, basically.
28
00:01:41,701 --> 00:01:42,871
It is a dream job.
29
00:01:43,031 --> 00:01:45,021
Let me tell you a story about
that because it's funny.
30
00:01:45,021 --> 00:01:48,691
So Sean parent who is known in the
C++ community was running this team.
31
00:01:49,091 --> 00:01:51,611
And he invited me to, to join it.
32
00:01:51,701 --> 00:01:55,181
And he said that this is, she sold
it pretty much as a dream job.
33
00:01:55,271 --> 00:01:58,391
And it was like, this is my dream job.
34
00:01:59,081 --> 00:02:02,231
And I got there and he convinced
me to swap positions with him.
35
00:02:02,441 --> 00:02:05,261
So I would run the team and
he would have my dream job.
36
00:02:05,441 --> 00:02:07,121
And he managed that.
37
00:02:07,271 --> 00:02:09,251
And I was like, I see what you did there.
38
00:02:09,311 --> 00:02:13,841
You created the dream job and then
you took it for yourself and made
39
00:02:13,841 --> 00:02:16,181
me the manager of the team, which
is, slightly less than the dream
40
00:02:16,181 --> 00:02:17,411
job of actually being on the team.
41
00:02:17,451 --> 00:02:17,811
But yeah
42
00:02:17,861 --> 00:02:24,201
It is, it takes a certain amount of
humility to humility is possibly the
43
00:02:24,201 --> 00:02:32,541
wrong word, but to be really, and
supportive of others and actually sharing
44
00:02:32,541 --> 00:02:35,481
in the facilitation of others' success.
45
00:02:35,481 --> 00:02:41,391
And so the being a manager is, I actually
think that's a better paid, let's say, but
46
00:02:41,391 --> 00:02:44,571
also a slightly underrated career track.
47
00:02:45,001 --> 00:02:48,061
People look down on management
in some ways as no longer
48
00:02:48,061 --> 00:02:49,171
being technical or something.
49
00:02:49,171 --> 00:02:53,961
But I think that it it is in some sense,
gracious that you are able to give
50
00:02:53,961 --> 00:02:59,331
that up and just to enable, let's say,
multiply your own thoughts by X. So
51
00:02:59,341 --> 00:03:00,781
that's a good thing too, in my opinion.
52
00:03:01,781 --> 00:03:02,771
Oh yeah, definitely.
53
00:03:02,861 --> 00:03:06,891
And I say this mostly in jest and
as lead of software technology
54
00:03:06,891 --> 00:03:10,761
lab, I'm still very much involved
in doing the actual technology.
55
00:03:10,831 --> 00:03:11,701
'Cause it's a very small team.
56
00:03:11,701 --> 00:03:13,561
There's only four people in the team.
57
00:03:13,991 --> 00:03:18,051
So yeah, I get to stay hands on and do all
the crap work that Sean was doing before.
58
00:03:18,141 --> 00:03:21,471
So I'm happy to have him spend his time
not doing that crap work and take that
59
00:03:21,516 --> 00:03:21,756
Yeah,
60
00:03:21,756 --> 00:03:24,336
look, some people have to be
professional, meaning goers, now
61
00:03:25,336 --> 00:03:25,556
Yes.
62
00:03:25,666 --> 00:03:32,086
anyway, we're gonna need the like
the actual chip number or like the
63
00:03:32,331 --> 00:03:35,241
part number of the microcontroller
that you're playing with at some
64
00:03:35,241 --> 00:03:37,021
point because I'm sure that the,
65
00:03:37,466 --> 00:03:41,726
This is the STM32C011J4M6.
66
00:03:41,966 --> 00:03:42,266
There you go.
67
00:03:42,321 --> 00:03:46,911
For anyone that is coming to Rust Forge
in, I guess it's six weeks time from
68
00:03:46,911 --> 00:03:52,961
this recording, Espressif is actually
donating several dozen microcontrollers.
69
00:03:52,991 --> 00:03:55,871
We haven't actually announced
this, so this is the big reveal,
70
00:03:56,201 --> 00:03:57,821
but it should be the case.
71
00:03:58,211 --> 00:04:00,306
I hope we're getting at least
one for everyone that it
72
00:04:00,306 --> 00:04:01,481
turn, that, that turns up.
73
00:04:01,841 --> 00:04:05,441
Yeah, no, so there, there's a segue in
there as well, but that's really great
74
00:04:05,981 --> 00:04:06,431
and.
75
00:04:07,356 --> 00:04:08,796
I am gonna be first in
line for that thing.
76
00:04:08,831 --> 00:04:09,311
Awesome.
77
00:04:09,731 --> 00:04:10,151
Awesome.
78
00:04:10,571 --> 00:04:17,501
The the next thing is, so it, you
are looking at the next 10 years of
79
00:04:17,501 --> 00:04:22,451
programming, let's say, in a very broad
way... rust is part of that story.
80
00:04:23,451 --> 00:04:23,841
Yes.
81
00:04:24,201 --> 00:04:29,231
When do you think large companies,
such as Adobe or there are many
82
00:04:29,501 --> 00:04:34,391
billion dollar companies, let's say,
when do you think large enterprises
83
00:04:34,901 --> 00:04:37,526
would've really started to notice rust?
84
00:04:38,526 --> 00:04:40,326
I think it's already started.
85
00:04:40,536 --> 00:04:41,636
And I can tell you
86
00:04:41,636 --> 00:04:42,481
Please do.
87
00:04:42,601 --> 00:04:42,841
Yeah.
88
00:04:42,896 --> 00:04:43,616
from the beginning.
89
00:04:43,626 --> 00:04:47,936
Back in 2024 they created
this memory Safety tiger team.
90
00:04:48,326 --> 00:04:48,596
Okay.
91
00:04:48,596 --> 00:04:52,506
And it included reps from security,
the software technology lab developer
92
00:04:52,536 --> 00:04:56,346
experience, and legal reps. And the
reason that it was created is because
93
00:04:56,346 --> 00:05:01,056
there was all this discussion of
legislation related to memory safety.
94
00:05:01,656 --> 00:05:05,526
And they wanted to figure
out like, what is this?
95
00:05:05,526 --> 00:05:06,936
What are we gonna do about it?
96
00:05:07,036 --> 00:05:11,826
And you had the NSA you had,
cisa, you had the White House
97
00:05:11,826 --> 00:05:13,266
even chiming in on this stuff.
98
00:05:13,326 --> 00:05:16,626
And at one point there was even a bill, I
think it was like a defense spending bill,
99
00:05:16,626 --> 00:05:20,441
like a typical bill that, that when it
was in the House of Representatives, the
100
00:05:20,441 --> 00:05:26,171
Congress they had like creating a memory
safety plan for the Department of Defense.
101
00:05:26,291 --> 00:05:30,101
And this little line got removed
when it went in the Senate.
102
00:05:30,501 --> 00:05:33,561
So it didn't actually end up in the
final thing that got approved, but the
103
00:05:33,561 --> 00:05:36,441
fact that it was there was like huge.
104
00:05:36,861 --> 00:05:39,921
And so this team got together
and we're like, okay, what
105
00:05:39,921 --> 00:05:41,481
do we need to do about this?
106
00:05:41,481 --> 00:05:45,611
And we investigated and we looked
at what was going on with like the
107
00:05:45,611 --> 00:05:47,051
published data that people were having.
108
00:05:47,051 --> 00:05:50,051
So you look at the numbers, it's okay,
the number of exploits in software
109
00:05:50,441 --> 00:05:55,511
that are due to memory safety versus
all the other exploits was like 70%.
110
00:05:55,841 --> 00:05:58,891
And you look at Microsoft's
numbers, it's 70%.
111
00:05:58,891 --> 00:06:01,211
You look at Google's numbers at 70%.
112
00:06:01,271 --> 00:06:03,811
And then we looked internally
and it's yeah, it's also
113
00:06:03,811 --> 00:06:04,951
right around that number too.
114
00:06:04,951 --> 00:06:09,961
So there, there's like something to this
and the idea that you can switch your
115
00:06:09,961 --> 00:06:15,931
technology and get rid of 70% of your
memory safety vulnerabilities like that.
116
00:06:16,591 --> 00:06:17,086
That was a big
117
00:06:17,176 --> 00:06:17,396
And
118
00:06:18,081 --> 00:06:22,551
my recollection of those papers as well,
it's not just 70% of bugs, let's say, but
119
00:06:22,581 --> 00:06:25,851
70% of severe and critical, severe use.
120
00:06:25,881 --> 00:06:27,096
So it's like these are the.
121
00:06:27,841 --> 00:06:31,261
The majority of the worst
cases of security problems.
122
00:06:31,651 --> 00:06:37,231
And yeah and we, and so this was a,
so I guess it sounds like there were
123
00:06:37,231 --> 00:06:41,661
probably engineers thinking, ah, for
the last multiple decades, and I'd
124
00:06:41,661 --> 00:06:47,261
be interested in C++ has had this
in front of mind for a long time.
125
00:06:47,801 --> 00:06:52,841
How do we deal with buffer overflows and
how do we deal with memory safety in a
126
00:06:52,841 --> 00:06:57,941
way that is strongly backwards compatible,
which I suppose is the C++ mantra really.
127
00:06:58,581 --> 00:07:05,861
And then we have this new programming
language, which somehow is able to
128
00:07:05,951 --> 00:07:12,671
offer memory safety without imposing
garbage collection or some sort of
129
00:07:12,671 --> 00:07:17,921
other form of runtime checking to
be able to allow things to work.
130
00:07:19,001 --> 00:07:24,641
But it was really the, it sounds like it
was really the fact that it had started
131
00:07:24,641 --> 00:07:30,671
to introduce legal risk that really
started to motivate internal people to
132
00:07:30,671 --> 00:07:34,181
say, okay, we're gonna fund something,
at least some sort of discussion to make
133
00:07:34,181 --> 00:07:35,771
a decision on how we're gonna proceed.
134
00:07:36,771 --> 00:07:43,901
It, for us, like the legal risk was why
upper level management got involved and
135
00:07:43,901 --> 00:07:46,301
they said, can you investigate this?
136
00:07:46,931 --> 00:07:51,101
When we investigated it, it wasn't like,
oh yes, there is significant legal risk.
137
00:07:51,101 --> 00:07:53,011
We're looking at these,
laws that are coming out.
138
00:07:53,431 --> 00:07:54,391
It was more.
139
00:07:55,361 --> 00:07:56,081
What about
140
00:07:56,166 --> 00:07:56,606
Yeah.
141
00:07:56,606 --> 00:07:56,966
actually.
142
00:07:57,101 --> 00:08:01,001
want our customers to use safe software.
143
00:08:01,451 --> 00:08:02,771
That's totally in our interest.
144
00:08:02,811 --> 00:08:06,471
And that's actually our driving
motivation in the, in this group,
145
00:08:06,471 --> 00:08:10,251
is we want to produce the most safe
software that we can for our consumers.
146
00:08:10,251 --> 00:08:15,991
You imagine, if somebody comes out
with a PDF that exploits your computer,
147
00:08:16,171 --> 00:08:17,791
how many people are using Acrobat?
148
00:08:17,841 --> 00:08:21,171
We, look, there's more people using,
have Acrobat Reader on their computer
149
00:08:21,381 --> 00:08:22,851
than people that use Firefox,
150
00:08:23,031 --> 00:08:24,081
like in total.
151
00:08:24,291 --> 00:08:28,561
So it's a huge swath and if you
take state actors or whatever yeah,
152
00:08:28,561 --> 00:08:30,951
if you wanna, get into people's
computers, you're gonna try to get
153
00:08:30,951 --> 00:08:32,751
in the software that most people use.
154
00:08:32,781 --> 00:08:34,431
And we're definitely in that space.
155
00:08:34,461 --> 00:08:34,731
Yeah.
156
00:08:34,731 --> 00:08:39,891
and PDF is not a simple format
to protect against really.
157
00:08:40,051 --> 00:08:43,291
I don't mean this, I don't mean to
cast any shade, but we've got multiple
158
00:08:43,291 --> 00:08:44,581
programming language interpreters.
159
00:08:44,581 --> 00:08:49,231
There's at least a JavaScript runtime
plus there's two other languages, right?
160
00:08:49,231 --> 00:08:53,941
It's own little macro language as well
as Postscript in there too, I think.
161
00:08:54,181 --> 00:08:54,541
but.
162
00:08:55,541 --> 00:08:57,281
It is extremely complicated.
163
00:08:57,281 --> 00:08:57,761
Yes.
164
00:08:57,841 --> 00:09:01,321
And the fact that it can embed a
JPEG or something like that and
165
00:09:01,411 --> 00:09:01,711
Oh yeah.
166
00:09:01,741 --> 00:09:06,151
'cause now every single codec that
you support also has decompression.
167
00:09:06,241 --> 00:09:10,821
And you've also got inter essentially,
like you have these baby interpreters
168
00:09:10,821 --> 00:09:13,911
for file formats, which are also
exploitable as browser vendors
169
00:09:13,911 --> 00:09:15,591
have discovered multiple times.
170
00:09:16,591 --> 00:09:16,831
Yeah.
171
00:09:16,831 --> 00:09:17,791
And, okay.
172
00:09:17,881 --> 00:09:24,331
So that would be good to be able to
defend against these kind of poisoned
173
00:09:24,361 --> 00:09:29,341
PDFs, which of course this is, that
that's a horrifically big vector of
174
00:09:29,701 --> 00:09:33,331
problems because of course you're going
to double click the PDF and open it.
175
00:09:33,491 --> 00:09:34,991
When you get that via email.
176
00:09:35,991 --> 00:09:36,441
Yeah.
177
00:09:37,141 --> 00:09:40,771
But like on the flip side, so from a
software technology lab perspective
178
00:09:41,371 --> 00:09:45,751
before memory safety became something
that everybody knew about and was
179
00:09:45,751 --> 00:09:49,261
talking about, we were already trying
to figure out what's going to be
180
00:09:49,771 --> 00:09:51,421
the future of programming languages.
181
00:09:51,731 --> 00:09:52,611
Is it going to be C++?
182
00:09:53,241 --> 00:09:54,921
Is it gonna be one of
these other languages?
183
00:09:55,251 --> 00:09:59,631
And from our perspec perspective on
that team, the memory safety wasn't
184
00:09:59,631 --> 00:10:03,461
actually the most interesting thing
about rust, as a language to move to.
185
00:10:04,031 --> 00:10:09,401
It's just, flatly better tech for
most applications, even if you didn't
186
00:10:09,401 --> 00:10:14,231
have the memory safety aspect, if you
look at like enums pattern matching
187
00:10:14,231 --> 00:10:19,341
traits, like all the procedurally macro
driven libraries that are in there.
188
00:10:19,731 --> 00:10:22,881
And there's a lot of stuff like
that just made it interesting.
189
00:10:23,121 --> 00:10:26,241
Hey, we want people to develop in these
languages because they're gonna be more
190
00:10:26,241 --> 00:10:29,871
productive and the code they're writing
is gonna be more maintainable and it's
191
00:10:29,871 --> 00:10:33,171
gonna be easier to hire developers
because it's easier to get them to learn
192
00:10:33,171 --> 00:10:34,491
the language and be able to work on it.
193
00:10:34,491 --> 00:10:38,811
This, these are like other big drivers
that I think stand on their own
194
00:10:38,811 --> 00:10:40,791
without even looking at the memory
195
00:10:40,986 --> 00:10:46,656
Yeah, I have been in very similar
discussions where people look and say,
196
00:10:46,686 --> 00:10:48,366
oh gosh, we've got this huge problem.
197
00:10:48,516 --> 00:10:49,956
And that's the motivating factor.
198
00:10:50,106 --> 00:10:53,316
But it turns out that rust is also
a very good programming language
199
00:10:53,616 --> 00:10:55,116
and it has lots of nice things.
200
00:10:55,116 --> 00:10:59,606
We have Iterators, for example, that
compose and just chain together quite
201
00:10:59,606 --> 00:11:01,976
nicely and also get optimized quite well.
202
00:11:02,426 --> 00:11:09,426
and then, from the point of view of
comparing rust to, let's say a Java C
203
00:11:09,426 --> 00:11:14,736
Sharp or even a Python or something,
and my background is primarily in web
204
00:11:14,736 --> 00:11:18,276
services and so forth, but we would
also say that we could probably reduce
205
00:11:18,276 --> 00:11:23,416
memory by, I don't know, 90% and
the cost of running an application.
206
00:11:23,516 --> 00:11:28,566
Suddenly we only require 80
megabytes of RAM at steady state.
207
00:11:28,566 --> 00:11:31,866
So we don't need giant instances
with lots and lots of heap.
208
00:11:32,016 --> 00:11:36,636
So actually we are able to produce
applications that run faster, serve
209
00:11:36,636 --> 00:11:38,616
users quicker, and or also more secure.
210
00:11:38,616 --> 00:11:42,346
And yeah, and by the way, yeah, also rust
is quite a nice programming language.
211
00:11:43,346 --> 00:11:48,326
And now we've got this other problem
that, you are advocating for a
212
00:11:48,326 --> 00:11:53,906
programming language or at least saying
to the rest of the company, by the
213
00:11:53,906 --> 00:11:56,901
way the grass is greener over there.
214
00:11:57,901 --> 00:12:02,591
How, but at some point, the
immune system of the organization
215
00:12:02,801 --> 00:12:10,251
responds to you and says, ah, we
have a lot of other languages.
216
00:12:10,251 --> 00:12:12,561
We don't want to add
another one to the mix.
217
00:12:13,561 --> 00:12:14,131
Yep.
218
00:12:14,501 --> 00:12:18,851
And we're definitely see those really
healthy immune system responses
219
00:12:18,941 --> 00:12:20,111
just like any, anywhere else.
220
00:12:20,621 --> 00:12:24,016
And I think that a lot
of what's been useful.
221
00:12:25,166 --> 00:12:29,246
To dispel some of the concerns
that people have has been the great
222
00:12:29,246 --> 00:12:31,106
data that's been put out there.
223
00:12:31,446 --> 00:12:36,366
So one of the concerns someone might say
is oh, but Rust is really complex, right?
224
00:12:36,416 --> 00:12:37,916
It's a hard language to learn.
225
00:12:38,366 --> 00:12:41,456
We can't wait for people to spend
three years learning this language
226
00:12:41,516 --> 00:12:43,136
to be able to be productive in it.
227
00:12:44,026 --> 00:12:48,086
And then for that point out to the
Google study that came out where it
228
00:12:48,086 --> 00:12:52,056
was like, I think it was after three
months of development and rust from
229
00:12:52,056 --> 00:12:55,656
someone that has no experience at the
beginning, two thirds outta people
230
00:12:55,916 --> 00:12:59,906
felt like they were very confident and
productive in this language, right?
231
00:12:59,906 --> 00:13:02,216
So that you just point to the data.
232
00:13:02,216 --> 00:13:06,126
It's like you can go with your
anecdotal, feeling about it, but
233
00:13:06,126 --> 00:13:08,166
why do that when we can look at the
data when there's been like, good
234
00:13:08,166 --> 00:13:09,336
studies that have been put out there.
235
00:13:09,766 --> 00:13:13,066
And so a lot of things like this it's
just like getting the right information
236
00:13:13,066 --> 00:13:14,356
in front of people so that they can.
237
00:13:14,971 --> 00:13:16,651
They don't have to go based on their gut.
238
00:13:16,651 --> 00:13:19,021
They can go based on something
more solid and tangible.
239
00:13:19,151 --> 00:13:20,626
I think that's been extremely helpful.
240
00:13:20,781 --> 00:13:23,151
I've never worked at Google, but
I've got lots of friends there.
241
00:13:23,781 --> 00:13:29,841
And one of the things that makes me
believe that research is that Google
242
00:13:29,841 --> 00:13:35,541
has full control over its build system
and the developer experience as well.
243
00:13:35,966 --> 00:13:36,296
Mm-hmm.
244
00:13:36,371 --> 00:13:39,101
of the things that I would
really like to pick up on was
245
00:13:39,221 --> 00:13:40,841
another claim around hiring.
246
00:13:41,141 --> 00:13:43,781
'cause I've heard that hiring
rust developers is really hard.
247
00:13:44,781 --> 00:13:50,391
So one thing I can say is that hiring
C++ developers is incredibly hard.
248
00:13:50,991 --> 00:13:54,441
And for us I can't share with
you the data, but I can say that
249
00:13:54,441 --> 00:13:58,521
it is astronomically harder than
hiring for any other language
250
00:13:58,521 --> 00:14:01,031
that we have especially in the us.
251
00:14:01,371 --> 00:14:04,771
And that is another one of the
motivations as to why we're looking at.
252
00:14:05,521 --> 00:14:08,491
Other languages that we can bring
on developers because if you've
253
00:14:08,491 --> 00:14:13,291
got a new project and you can't
staff it then, but you can change
254
00:14:13,291 --> 00:14:14,341
the language and staff it better.
255
00:14:14,341 --> 00:14:16,621
You may just change the
language based on that alone.
256
00:14:17,251 --> 00:14:22,481
And so we looked a lot at the adoption of
Rust in the wider community and we looked
257
00:14:22,481 --> 00:14:24,521
at again, we're like, let's see the data.
258
00:14:25,061 --> 00:14:29,091
And so there was a Stack Overflow
survey that that came out.
259
00:14:29,091 --> 00:14:34,081
I think if you look at the 2024 Stack
Overflow survey we crunched the data and
260
00:14:34,081 --> 00:14:38,951
we looked at the number of developers
that are C++, and we looked at what
261
00:14:38,951 --> 00:14:41,921
portion of C++ developers right now.
262
00:14:42,481 --> 00:14:47,761
Are also rust developers and it
was 20%, kinda blew our mind.
263
00:14:48,031 --> 00:14:51,061
20% of all C++ developers
are also developing rust.
264
00:14:51,061 --> 00:14:53,881
And this is like the question was
asked like, have you programmed this
265
00:14:53,881 --> 00:14:55,471
seriously, like in the past year?
266
00:14:56,131 --> 00:14:59,581
And that's huge and, but maybe
that's Stack Overflow could be weird.
267
00:14:59,611 --> 00:15:01,051
Only weird people flow out that survey.
268
00:15:01,441 --> 00:15:06,901
But we also looked at the data from
GitHub and one for every five C++
269
00:15:06,901 --> 00:15:10,111
PRs on GitHub, there's one Rust PR.
270
00:15:10,921 --> 00:15:12,931
So again, like similar kind of number.
271
00:15:12,991 --> 00:15:17,521
There's just a lot of people
programming Rust it turns out.
272
00:15:17,851 --> 00:15:21,101
And I've asked this question at
conferences that I give talks at what, how
273
00:15:21,101 --> 00:15:22,511
many of you are programming Rust as well?
274
00:15:22,511 --> 00:15:23,861
It's like similar number everywhere.
275
00:15:23,861 --> 00:15:25,721
It seems to be right around 20%.
276
00:15:26,141 --> 00:15:29,761
And that's changed from
16% like five years ago.
277
00:15:30,121 --> 00:15:33,421
It's just been like a drastic increase
in the number of Rust developers.
278
00:15:33,421 --> 00:15:36,856
So I, I. Do not have concerns
of hiring Rust developers.
279
00:15:36,856 --> 00:15:38,956
If you say you got a rust
position, you got like a bunch
280
00:15:38,956 --> 00:15:43,036
of people going wild because they
would love to do rust full time.
281
00:15:43,096 --> 00:15:47,416
Just because it's, you just feel
better programming in that language.
282
00:15:47,416 --> 00:15:50,086
Like going from Rust back to
C++ kind of hurts a little bit.
283
00:15:50,086 --> 00:15:54,266
You die a little bit inside when you come
back to that C++ project, and so there's
284
00:15:54,286 --> 00:15:59,626
just enough enthusiasm for it that's, that
isn't a concern, although people raise it.
285
00:15:59,686 --> 00:16:01,246
But look at the data again.
286
00:16:01,296 --> 00:16:03,576
It, it really isn't in
actuality a concern.
287
00:16:03,606 --> 00:16:07,986
Yeah, there is a lot of I forget the
term, but it, there's a particular
288
00:16:08,106 --> 00:16:12,816
psychological bias where we are afraid
of change because of its loss aversion, I
289
00:16:12,816 --> 00:16:21,086
think where it's will, people are hesitant
to take on change or risk even when the.
290
00:16:21,971 --> 00:16:24,281
The outcome is likely to be positive.
291
00:16:24,701 --> 00:16:28,691
The other thing that I have found
people resisting is this idea
292
00:16:28,691 --> 00:16:30,521
that Rust is as good as it sounds.
293
00:16:31,331 --> 00:16:34,661
People make this claim around, oh, it's a
really lovely programming language to use.
294
00:16:34,661 --> 00:16:37,241
We finally have a genuine type system.
295
00:16:37,421 --> 00:16:41,561
We have no, we now, pointers don't
really exist in the language.
296
00:16:42,561 --> 00:16:45,531
And it's like, where's the catch?
297
00:16:46,531 --> 00:16:55,396
and I guess the next thing to chat
about would be when so Photoshop sounds
298
00:16:55,396 --> 00:16:57,556
like there are changes happening.
299
00:16:59,206 --> 00:16:59,926
What's happening?
300
00:17:00,926 --> 00:17:01,106
Yeah.
301
00:17:01,206 --> 00:17:07,226
We are we are at the stage to where we've
done a couple of pilot projects of where
302
00:17:07,226 --> 00:17:11,466
we're doing rust inside of Photoshop,
and we're seeing how that's going.
303
00:17:11,466 --> 00:17:12,556
Like what exactly happened?
304
00:17:12,556 --> 00:17:15,286
So we took a team, we said,
okay, we have a project here.
305
00:17:15,596 --> 00:17:18,836
We want you to do this
in rust for Photoshop.
306
00:17:19,166 --> 00:17:20,846
What is your experience of that?
307
00:17:21,266 --> 00:17:26,441
And it came out what you would expect,
the people who use the language loved it.
308
00:17:26,491 --> 00:17:29,561
They're reticent to go back
to like a C++ kind of thing.
309
00:17:30,061 --> 00:17:34,141
Um, after that, um, they saw
the productivity gains, uh,
310
00:17:34,231 --> 00:17:35,821
especially being able to use cargo.
311
00:17:36,091 --> 00:17:38,221
I mean, one of the most
powerful experiences you can
312
00:17:38,221 --> 00:17:39,541
have is when you're like, Hmm.
313
00:17:40,351 --> 00:17:43,591
I think it'd be nice if we had
a, a, a JavaScript interpreter in
314
00:17:43,591 --> 00:17:47,791
this program, and you just add a
JavaScript interpreter with like
315
00:17:47,791 --> 00:17:50,871
one line, uh, in your cargo thing.
316
00:17:51,301 --> 00:17:56,521
But coming from a C++ background that
is black magic, that should not be that
317
00:17:56,821 --> 00:18:02,341
I look who doesn't love tinkering with
sea make or whichever build systems
318
00:18:02,431 --> 00:18:04,531
that you feel like creating today.
319
00:18:04,871 --> 00:18:07,211
Why even have one build system
when you could have four in
320
00:18:07,211 --> 00:18:08,141
your project or something?
321
00:18:08,141 --> 00:18:12,791
I don't mean to be too rude, but Rust
has definitely benefited from being
322
00:18:12,791 --> 00:18:19,196
late essentially, or learning from
the experiences of the past and oh,
323
00:18:19,196 --> 00:18:20,996
that's, so that's really validating.
324
00:18:21,116 --> 00:18:25,106
So you've got this public research,
we've got this Google study,
325
00:18:25,106 --> 00:18:28,286
we've had other kind of language
other wider bits and pieces.
326
00:18:28,496 --> 00:18:35,336
And now internally you're validating that
yourself and you're not proven, you are
327
00:18:35,486 --> 00:18:42,686
that then able to demonstrate that not
just the language is okay, but it would
328
00:18:42,686 --> 00:18:48,786
work well inside the build system or
inside the context of of the rest of the
329
00:18:48,786 --> 00:18:50,526
environment within, inside the company.
330
00:18:51,526 --> 00:18:51,976
Yeah.
331
00:18:52,226 --> 00:18:56,721
There was one thing that the
experience pointed to that was.
332
00:18:57,791 --> 00:18:59,201
Bad for rust.
333
00:18:59,206 --> 00:18:59,486
Okay.
334
00:18:59,491 --> 00:19:01,031
'cause they give outta how many stars?
335
00:19:01,031 --> 00:19:02,711
Three, four outta five stars.
336
00:19:02,711 --> 00:19:03,401
Everything's great.
337
00:19:03,401 --> 00:19:04,091
Hunky dory.
338
00:19:04,571 --> 00:19:09,271
But when you get to the C++ interop, that
was where it was like that's a problem.
339
00:19:09,271 --> 00:19:15,621
And so what we used was c bin gen.
So essentially you're writing these,
340
00:19:16,071 --> 00:19:18,651
the C functions in rust, right?
341
00:19:18,651 --> 00:19:21,241
But that you can call from C and
that'll generate a header, which
342
00:19:21,241 --> 00:19:22,411
we'll call those C functions.
343
00:19:22,781 --> 00:19:25,751
And then the implementation
of those functions will call
344
00:19:25,801 --> 00:19:26,881
your underlying rust code.
345
00:19:27,481 --> 00:19:35,361
And this involves a lot of unsafe, it also
involves a lot of cism stuff that, that
346
00:19:35,361 --> 00:19:38,431
C++ people aren't familiar with, right?
347
00:19:38,431 --> 00:19:39,931
If you go back to the.
348
00:19:40,771 --> 00:19:44,881
Back in the day when you were writing
C callbacks, you have a callback
349
00:19:45,391 --> 00:19:47,941
pointer function that you function,
pointer that you pass in, but you
350
00:19:47,941 --> 00:19:51,301
also have to pass and avoid star
for the context of that callback.
351
00:19:51,301 --> 00:19:54,921
And that's just like this idiom
that you do in C to do callbacks.
352
00:19:55,401 --> 00:19:59,361
But if you want to have a interop
layer in C you have to do this
353
00:19:59,361 --> 00:20:00,441
and you have to understand it.
354
00:20:00,861 --> 00:20:05,901
And so what we found is that when
you take somebody who's like C++, you
355
00:20:05,901 --> 00:20:09,651
know, expert or very familiar with
the language, and the first thing they
356
00:20:09,651 --> 00:20:15,681
need to do is go to the most gnarly,
awful part of rust, which is unsafe.
357
00:20:15,711 --> 00:20:20,631
Weird stuff with pointers,
like that experience is not
358
00:20:20,826 --> 00:20:22,576
so let me paint the picture.
359
00:20:22,696 --> 00:20:24,311
So what we would like to do.
360
00:20:25,976 --> 00:20:31,226
Is basically pass objects around and
their interfaces in some sort of ideal,
361
00:20:31,506 --> 00:20:39,476
essentially extend C++ or like bolt,
either graft rust onto C++ in some way.
362
00:20:39,736 --> 00:20:44,406
Or graft C++ into rust or whatever.
363
00:20:44,426 --> 00:20:50,246
So that a rust programmer could just
interact with methods from C++, uh, as
364
00:20:50,376 --> 00:20:52,956
though they were essentially native.
365
00:20:53,046 --> 00:20:58,746
But we don't have anything like that
because the two compilers don't know
366
00:20:58,746 --> 00:21:00,726
any really, we don't know enough.
367
00:21:01,206 --> 00:21:02,211
They don't know enough about each other.
368
00:21:02,241 --> 00:21:07,156
They it's a, you would need to
teach Rust, all of C++ in order
369
00:21:07,156 --> 00:21:09,716
for that to work in that way.
370
00:21:10,366 --> 00:21:15,096
maybe I should also chat a little bit
about this concept of passing function
371
00:21:15,096 --> 00:21:20,436
pointers around for anyone that's
although maybe you can correct me here,
372
00:21:20,436 --> 00:21:24,866
David, because I'm sure that this isn't
technically precise, but essentially the
373
00:21:24,866 --> 00:21:29,256
C++ and Rust worlds, they need to talk to
each other through symbols in the binary.
374
00:21:29,256 --> 00:21:31,836
So they, when they lo the linker
creates things and all they really
375
00:21:31,836 --> 00:21:33,426
have is text strings to match on.
376
00:21:33,486 --> 00:21:34,696
It's or memory addresses.
377
00:21:35,266 --> 00:21:38,416
That void star is a memory address.
378
00:21:38,596 --> 00:21:42,106
And then C C doesn't really
have a strong type system.
379
00:21:42,106 --> 00:21:46,606
So you can basically say that any
chunk of memory is any given type.
380
00:21:46,606 --> 00:21:51,196
So what you'll typically do is if
you're calling some external function or
381
00:21:51,286 --> 00:21:56,416
trying to call one of its functions is
get the symbol, find, de resolve this.
382
00:21:56,416 --> 00:21:58,126
The, you ask the linker to resolve the.
383
00:21:58,831 --> 00:22:04,231
Memory address, what have you, and then
call the function with a buffer that
384
00:22:04,231 --> 00:22:09,851
you have allocated and then expect,
just hope that the function does what it
385
00:22:09,851 --> 00:22:17,951
says, and then you need to reinterpret
your buffer as the result type.
386
00:22:18,041 --> 00:22:21,171
So essentially this void star
just means any type at all.
387
00:22:21,261 --> 00:22:22,791
How correct was that?
388
00:22:22,911 --> 00:22:24,231
It was that ish.
389
00:22:25,231 --> 00:22:25,681
Yeah.
390
00:22:25,771 --> 00:22:26,011
Yeah.
391
00:22:26,011 --> 00:22:26,491
That's.
392
00:22:26,776 --> 00:22:28,276
That's generally correct.
393
00:22:28,276 --> 00:22:32,706
So when interfacing between C++ and
Rust, if you want to do something
394
00:22:33,186 --> 00:22:38,016
higher level than C right, you're
usually have a C intermediate
395
00:22:38,016 --> 00:22:41,346
layer and the C intermediate layer.
396
00:22:41,396 --> 00:22:45,806
Let's say you want to pass
a C++ object over to Rust
397
00:22:45,876 --> 00:22:48,476
Rust doesn't have a idea
of what C++ objects are.
398
00:22:48,476 --> 00:22:53,586
So you get a void star or you get a
pointer, just a, an address and memory.
399
00:22:54,366 --> 00:22:58,726
And so when you wanna call back
into C++, you just pass that
400
00:22:58,746 --> 00:23:01,596
pointer back and hopefully it does
the right thing and then do that.
401
00:23:01,596 --> 00:23:04,656
But it's not just for the object, it's
for any argument, for any return type.
402
00:23:05,076 --> 00:23:08,646
All this is going through some
like void stars under the hood.
403
00:23:09,006 --> 00:23:13,656
But I ideally you want to be better
than what we did with that project,
404
00:23:13,656 --> 00:23:16,506
which is using like cbindgen, you want
to have something which is richer.
405
00:23:17,031 --> 00:23:21,011
And get this kind of interop
working between C++ and
406
00:23:21,011 --> 00:23:22,281
Rust in a more seamless way.
407
00:23:22,761 --> 00:23:26,541
And so a lot of my work has
been how do we make this happen?
408
00:23:26,701 --> 00:23:27,841
And how do we get this to work?
409
00:23:27,841 --> 00:23:31,116
And I can go very deep into that
subject if you're interested, if...
410
00:23:31,816 --> 00:23:36,346
Hit me because the this is something
that lots of people are thinking
411
00:23:36,386 --> 00:23:39,921
a lot about, and if you wanna
share, they would love to listen.
412
00:23:40,921 --> 00:23:41,311
Sure.
413
00:23:41,411 --> 00:23:42,521
So to start out,
414
00:23:42,621 --> 00:23:46,821
the model of objects is very
different between C++ and Rust.
415
00:23:46,871 --> 00:23:53,741
If you have a Rust object at some
place in memory, you can always just
416
00:23:53,891 --> 00:23:56,861
copy the bites from that place in
memory to another place in memory.
417
00:23:57,161 --> 00:24:01,391
And that effectively moves the object and
the object is valid in this other spot.
418
00:24:01,841 --> 00:24:05,501
So if you do assignment in
rust, like A equals B, um.
419
00:24:05,801 --> 00:24:10,241
You know, it, the, the way to think about
it is, is basically taking the memory that
420
00:24:10,391 --> 00:24:14,561
or b was pointing to and, and make that
the memory, the A is pointing to, right?
421
00:24:14,561 --> 00:24:16,091
It's just moving the memory around.
422
00:24:16,821 --> 00:24:25,361
Um, so in, in C++ that's not how things
work in general, if you have a, an object,
423
00:24:26,201 --> 00:24:30,461
like let's say you have a, a, a stu list,
like a link list or something along these
424
00:24:30,461 --> 00:24:34,181
lines, and the stu list is implemented
this way, uh, in, in many compilers.
425
00:24:34,251 --> 00:24:35,091
Oh, there is another,
426
00:24:35,541 --> 00:24:36,261
lists.
427
00:24:36,641 --> 00:24:40,141
because obviously in C++ we've
got, we don't have one compiler.
428
00:24:40,321 --> 00:24:44,341
We have a standard which is
implemented by many vendors
429
00:24:46,251 --> 00:24:49,401
yeah, and in this case the standard
library, the implementation of
430
00:24:49,401 --> 00:24:50,961
standard lists is different.
431
00:24:50,961 --> 00:24:54,341
Now, one, one implementation that
Microsoft has I dunno if they
432
00:24:54,341 --> 00:24:58,001
still have it, but they had for
years, is that the end node of
433
00:24:58,001 --> 00:25:02,951
the list is in the class itself.
434
00:25:03,821 --> 00:25:07,251
So you create a stud list the
end nodes in the class itself.
435
00:25:07,251 --> 00:25:09,621
It doesn't have to allocate when you
first create a stud list because it
436
00:25:09,621 --> 00:25:14,541
just has the start node, pointer point
to an object in the class itself.
437
00:25:15,201 --> 00:25:19,911
Now the problem is if you take the
memory of a stud list and you just put
438
00:25:19,911 --> 00:25:24,451
it to a different location and say,
okay, now the object's over there, that
439
00:25:24,451 --> 00:25:29,671
end Noe is now pointing back to where
the original stood list was, right?
440
00:25:30,241 --> 00:25:33,656
So you don't actually have a
well-defined object if you just
441
00:25:33,656 --> 00:25:35,306
copy the memory to somewhere else.
442
00:25:35,636 --> 00:25:39,946
The way that you move things in C++
is through a like a move constructor
443
00:25:39,946 --> 00:25:44,806
or a move assignment operator, where
you by hand say how to create the
444
00:25:44,806 --> 00:25:47,596
object in the new location, which
is equivalent to the old location.
445
00:25:47,926 --> 00:25:50,806
And that works totally fine with the
stood list example, because you just.
446
00:25:51,151 --> 00:25:52,861
Update that end node to the right spot.
447
00:25:53,431 --> 00:25:57,031
But this mis mismatch turns out
to be a really big deal when
448
00:25:57,031 --> 00:26:01,131
you want to interact with Rust,
because everything in Rust is mem-
449
00:26:01,231 --> 00:26:05,021
Just copy the memory from one place to
another, and if you put a C++ object in
450
00:26:05,021 --> 00:26:08,461
Rust and you just assign it to something
else, now all of a sudden you cata
451
00:26:10,051 --> 00:26:11,821
catastrophically broke your objects.
452
00:26:12,751 --> 00:26:17,461
And so that, that's like a major problem.
453
00:26:17,461 --> 00:26:21,901
If you want to be able to talk about C++
objects when you're operating within Rust.
454
00:26:22,906 --> 00:26:23,386
Wow.
455
00:26:23,446 --> 00:26:25,876
Yeah, no, that makes a lot of sense.
456
00:26:25,876 --> 00:26:30,886
And it's a pretty gnarly problem
because you've got essentially two
457
00:26:30,886 --> 00:26:36,446
worldviews and that, and I was thinking,
oh, couldn't you just overload the
458
00:26:36,446 --> 00:26:42,506
copy trait for particular bits and
pieces, but then not really no.
459
00:26:42,556 --> 00:26:43,366
That sounds tricky.
460
00:26:44,366 --> 00:26:47,516
It's very tricky because Rust
gives you this guarantee.
461
00:26:47,906 --> 00:26:53,276
A bunch of generic code is out
there, which will directly mem copy
462
00:26:53,276 --> 00:26:56,186
things around, and that's totally
463
00:26:56,186 --> 00:26:57,716
valid for every type that you give it.
464
00:26:58,766 --> 00:27:01,616
And so what do you do?
465
00:27:01,856 --> 00:27:04,096
So like the ways that people
have been working around this
466
00:27:04,096 --> 00:27:06,066
issue one is through pinning.
467
00:27:06,696 --> 00:27:10,836
So if you pin and type in Rust
or an object in Rust, you're
468
00:27:10,836 --> 00:27:15,096
basically saying this object cannot
move from this piece of memory.
469
00:27:15,936 --> 00:27:17,946
So assignment and all this
kind of stuff just doesn't work
470
00:27:17,946 --> 00:27:19,246
with that as you would expect.
471
00:27:19,306 --> 00:27:20,386
'cause it's just pinned in memory.
472
00:27:20,746 --> 00:27:25,456
And if you use a pinned
interface, the drawback is it's
473
00:27:25,456 --> 00:27:27,526
very not ergonomic and Rust.
474
00:27:27,616 --> 00:27:31,096
It's like you work with a pinned object,
you're just like, oh, great, now I'm
475
00:27:31,096 --> 00:27:34,966
gonna have a bad day because this is just
not friendly, good rust code anymore.
476
00:27:35,456 --> 00:27:40,376
And so the CXX crate, which
is one, one way to do C++ Rust
477
00:27:40,376 --> 00:27:42,306
in a wrap follows this method.
478
00:27:42,396 --> 00:27:44,466
And then you have to deal
with that as a drawback.
479
00:27:45,006 --> 00:27:50,526
Another option, and this is what
Zengar does, so Zengar, Z-N-G-U-R,
480
00:27:50,736 --> 00:27:52,446
it's not very well known yet.
481
00:27:52,446 --> 00:27:55,416
I'm trying to get more awareness to
this c plus interop solution 'cause
482
00:27:55,416 --> 00:27:56,956
it's it's very good in many ways.
483
00:27:57,196 --> 00:28:01,126
But anyway, Zengar, what they
do is they say, okay, we will.
484
00:28:01,456 --> 00:28:04,526
Just allocate every time
we create a C++ object.
485
00:28:04,546 --> 00:28:06,856
So it always creates a
C++ object on the heap.
486
00:28:07,756 --> 00:28:10,546
And that way when things are
assigned, you're just copying
487
00:28:10,546 --> 00:28:12,326
that pointer, back and forth.
488
00:28:12,326 --> 00:28:14,216
But then you're paying a
heap allocation, right?
489
00:28:14,216 --> 00:28:16,406
And that we lose our
high performance there.
490
00:28:16,856 --> 00:28:17,366
At least.
491
00:28:17,366 --> 00:28:17,786
At least.
492
00:28:17,876 --> 00:28:18,056
Yeah.
493
00:28:18,086 --> 00:28:18,306
So
494
00:28:18,311 --> 00:28:22,801
just, and this may, this is probably
obvious to most, but I'll just
495
00:28:22,801 --> 00:28:27,091
reiterate it for my own ignorance
perhaps, but mem copy is a ridiculously
496
00:28:27,091 --> 00:28:31,291
trick, which I like sub, like
single digit cycles time probably.
497
00:28:31,651 --> 00:28:37,171
Whereas, and so this is, a millionth
of a second a nanosecond scale.
498
00:28:37,501 --> 00:28:44,451
And then a heap allocation, is anywhere,
10 to a hundred and 150, let's say.
499
00:28:44,501 --> 00:28:48,451
It's it's a lot of time if you're
creating a lot of objects or if
500
00:28:48,451 --> 00:28:51,331
you're just doing assignment a lot
like sort of updates and you have
501
00:28:51,331 --> 00:28:52,711
to pay that cost every single time.
502
00:28:53,131 --> 00:28:54,871
That would be annoying.
503
00:28:55,226 --> 00:28:57,451
Y Yeah.
504
00:28:57,511 --> 00:28:58,921
If I recall correctly, it's a thousand
505
00:28:58,921 --> 00:29:00,271
times slower.
506
00:29:00,511 --> 00:29:03,241
So it's a substantial thing, especially
if you get a vector of these things.
507
00:29:03,721 --> 00:29:05,991
Now you pay that for, big ON,
508
00:29:06,291 --> 00:29:10,826
Yeah, although references I guess which
are just pointers really can, obviously
509
00:29:10,826 --> 00:29:15,566
they're just the, in the rust world or
we call this like the U size or the size
510
00:29:15,566 --> 00:29:18,446
of the bits of the SCPU architecture.
511
00:29:18,926 --> 00:29:21,146
They're instantaneous
to copy around anyway.
512
00:29:21,146 --> 00:29:25,076
So this is a, one of the advantages
of like plunking things on the heap.
513
00:29:25,436 --> 00:29:29,366
You pay, you amortize the cost
of that allocation once because
514
00:29:29,366 --> 00:29:32,756
you can now mem copy as many
times as you require later on.
515
00:29:33,756 --> 00:29:33,976
Yes.
516
00:29:34,461 --> 00:29:34,731
Yep.
517
00:29:36,591 --> 00:29:43,161
Um, so there was a new feature
that got added to C++ 26.
518
00:29:43,231 --> 00:29:46,781
We're in 25, so it hasn't come out
yet, but it's in the latest C++ draft,
519
00:29:47,611 --> 00:29:51,411
um, called Trivial Relocateability.
520
00:29:52,731 --> 00:29:56,811
And what this does is it identifies.
521
00:29:57,361 --> 00:30:03,981
The types in C++ to a rough approximation,
that can be me copied around because
522
00:30:03,981 --> 00:30:08,661
it turns out that stood list example,
like that's, that's an outlier.
523
00:30:08,781 --> 00:30:13,221
Most things like a Stu Vector, most
classes that you would write, you
524
00:30:13,221 --> 00:30:16,761
could actually just move the memory
to new location and it would work.
525
00:30:16,761 --> 00:30:17,031
Okay.
526
00:30:17,031 --> 00:30:20,701
It's technically undefined behavior, but
it works because that's just how it is.
527
00:30:21,241 --> 00:30:27,211
So the idea behind Trivial Relocateability
was to see if there's a way to make
528
00:30:27,211 --> 00:30:31,711
this carve out of types that support
this and make that defined behavior.
529
00:30:32,881 --> 00:30:37,251
And so the thought was, oh, okay then
maybe any type, which is trivially
530
00:30:37,251 --> 00:30:43,741
relocatable in C++ 26, we can put this
on the rust stack and do stuff with it.
531
00:30:44,671 --> 00:30:45,091
If
532
00:30:45,266 --> 00:30:47,186
did note that this was in the past tense.
533
00:30:48,186 --> 00:30:48,576
Yeah.
534
00:30:49,536 --> 00:30:54,876
The problem was there's a new architecture
that Apple's coming out with is called
535
00:30:54,876 --> 00:31:03,556
ARM 64 E, and it's a security a BI change
primarily created for security purposes.
536
00:31:04,246 --> 00:31:09,806
And what they did is you, if you have
a polymorphic type in C++, so something
537
00:31:09,806 --> 00:31:14,026
that inherits from something with a
virtual function, um, that needs to have
538
00:31:14,026 --> 00:31:17,776
a V table in C++ to, to, in case you
cast it to a base class, you need to
539
00:31:17,776 --> 00:31:19,486
point to the right function and so on.
540
00:31:20,056 --> 00:31:25,946
And so there's a pointer in every
polymorphic object to the V table, right?
541
00:31:26,336 --> 00:31:28,286
And this pointer is transparent to users.
542
00:31:28,286 --> 00:31:30,266
You don't actually see that
it's there or whatever.
543
00:31:30,686 --> 00:31:34,886
Me copying objects with a V
table is totally fine up until.
544
00:31:35,616 --> 00:31:41,146
Arm 64 E. And what they did for
security purposes is they said, look,
545
00:31:42,406 --> 00:31:47,656
the V table pointer is a great way
for hackers to, to own your process
546
00:31:47,656 --> 00:31:51,836
because they can just take that
pointer and point it to their own code.
547
00:31:51,866 --> 00:31:55,496
And next time you call a virtual function,
you're going into the attacker's code.
548
00:31:56,096 --> 00:32:00,776
So they said what we're gonna do is we're
gonna take the V table pointer and use
549
00:32:00,776 --> 00:32:03,986
some of the extra bits in it because
nobody actually has two to the 64 memory.
550
00:32:03,986 --> 00:32:09,836
So they're gonna use these upper level
bits and add some data in there that ties
551
00:32:09,986 --> 00:32:18,296
that V table pointer to the object, which
contains the V table pointer, right?
552
00:32:18,836 --> 00:32:22,976
So that way if an attacker changes the
VT pointer to something else, if it
553
00:32:22,976 --> 00:32:27,086
tries to execute that V table pointer,
it'll be like, Nope, can't do that.
554
00:32:27,326 --> 00:32:28,646
You lost the signature, which
555
00:32:28,841 --> 00:32:34,851
So the CPU will essentially fault
because the yeah we've, it, I'm
556
00:32:34,851 --> 00:32:36,411
just going to use naive link.
557
00:32:36,411 --> 00:32:40,731
Maybe this isn't, but it sounds a lot like
a capabilities model where the original
558
00:32:40,881 --> 00:32:44,971
or some sort of providence back to the
original memory address, let's say.
559
00:32:45,511 --> 00:32:50,401
And if you Yeah, change the
destination, those parity bits won't
560
00:32:50,911 --> 00:32:55,621
work and therefore, or let some
sort of checks sum, and then, oh.
561
00:32:57,321 --> 00:33:01,881
Your program will crash, which is
probably better than having some un
562
00:33:01,911 --> 00:33:06,171
foreign code execute until you want to do
563
00:33:06,171 --> 00:33:09,051
something fun like interrupt with rust.
564
00:33:10,051 --> 00:33:10,381
Yep.
565
00:33:10,451 --> 00:33:11,041
Exactly.
566
00:33:11,621 --> 00:33:16,051
And so in the C++ world, they solve
this problem by saying, okay instead
567
00:33:16,051 --> 00:33:19,051
of saying, you can mem copy all
these types to move them around,
568
00:33:19,531 --> 00:33:24,331
you can call this trivially relocate
function and that will do it for you.
569
00:33:24,781 --> 00:33:27,511
You trivially relocate, it does
the mem copy and it does all the V
570
00:33:27,511 --> 00:33:32,201
table pointer fix ups, and that's
all fine and dandy in the C++ world.
571
00:33:32,221 --> 00:33:36,691
But now you go back to the Rust
interop, Rust isn't gonna do any
572
00:33:36,691 --> 00:33:38,311
vtable pointer fix ups for you, right?
573
00:33:38,311 --> 00:33:40,201
It's literally copying the memory.
574
00:33:40,841 --> 00:33:44,441
And so that kind of broke that idea.
575
00:33:44,951 --> 00:33:51,441
And so what we're trying to do now
is add a new feature to C++, and
576
00:33:51,611 --> 00:33:53,821
this is primarily for Rust interop.
577
00:33:54,481 --> 00:34:00,691
And what this will do is instead of having
the primitive copy thing from location
578
00:34:00,691 --> 00:34:04,711
A to location B, and then do the V two
table pointer, fix up, it's going to
579
00:34:05,461 --> 00:34:07,471
get a pointer to where it used to live.
580
00:34:08,581 --> 00:34:12,631
And a pointer to the current
location and do the fix up that way.
581
00:34:12,631 --> 00:34:16,411
So, essentially separating the movement
of the memory from the point, the v
582
00:34:16,411 --> 00:34:19,741
table pointer, fix ups, if you have that.
583
00:34:20,821 --> 00:34:25,271
Then on the rust side, if you
get an object, and this is
584
00:34:25,271 --> 00:34:26,621
hard to explain it, a podcast
585
00:34:26,856 --> 00:34:27,236
yeah.
586
00:34:27,401 --> 00:34:28,031
I'll do my best.
587
00:34:28,376 --> 00:34:29,186
It's not the best,
588
00:34:29,546 --> 00:34:29,816
not
589
00:34:29,876 --> 00:34:31,556
it's not the universal medium, let's say.
590
00:34:33,491 --> 00:34:34,871
Yes.
591
00:34:34,941 --> 00:34:40,581
You create your object on the, your
c plus object on the rust stack.
592
00:34:40,701 --> 00:34:44,931
But you add a little bit at the
end, which is enough for a pointer.
593
00:34:46,191 --> 00:34:49,611
And so when you initially create the
object, you have all your data for
594
00:34:49,611 --> 00:34:53,481
the object and you have a pointer,
which is just happens to be set
595
00:34:53,481 --> 00:34:55,431
to where the object's location is.
596
00:34:56,541 --> 00:34:59,451
Now on the rest side, you can
assign, you can move things around.
597
00:34:59,451 --> 00:35:01,881
Now the object is in some
other location somewhere else.
598
00:35:02,346 --> 00:35:07,566
And that pointer is still set to the
original place that object lived.
599
00:35:08,166 --> 00:35:11,346
The data for that object is the data
that we're what it used to be, but
600
00:35:11,346 --> 00:35:13,716
it's just in a new location now.
601
00:35:13,716 --> 00:35:18,156
When you call a c plus function, you
need to make sure this is all fixed up.
602
00:35:19,296 --> 00:35:23,106
So when you call your intermediate C
layer, which eventually calls your C
603
00:35:23,106 --> 00:35:27,576
function, that intermediate C layer will
call that special new function that got
604
00:35:27,576 --> 00:35:31,236
added to the standard, which says, Hey,
here's the pointer to the old location.
605
00:35:31,236 --> 00:35:32,766
Here's the data at the new location.
606
00:35:33,156 --> 00:35:36,216
It'll fix up all the pointers
for you, and now it's valid.
607
00:35:36,246 --> 00:35:39,456
And define behavior to call that c
plus function that you were calling.
608
00:35:40,521 --> 00:35:42,091
That sounds innovative.
609
00:35:42,301 --> 00:35:42,811
Well done.
610
00:35:43,231 --> 00:35:45,251
It's have you unlocked the puzzle?
611
00:35:45,461 --> 00:35:46,781
Have you solved the puzzle, do you think?
612
00:35:46,841 --> 00:35:47,831
Or at least
613
00:35:48,831 --> 00:35:49,551
I, think.
614
00:35:50,436 --> 00:35:50,826
okay.
615
00:35:50,841 --> 00:35:53,941
we may have, there are still some
open questions on how to deal
616
00:35:53,941 --> 00:35:58,931
with this on the rust side because
that works fine and dandy for, uh,
617
00:35:58,961 --> 00:36:01,011
C++ objects you create in Rust.
618
00:36:01,321 --> 00:36:05,171
But what if C++ gives you an object or
a reference to one of those objects?
619
00:36:05,171 --> 00:36:06,731
Now that one doesn't have the little
620
00:36:06,791 --> 00:36:10,451
space at the end with the pointer,
so that might be a different type.
621
00:36:10,496 --> 00:36:12,836
You might want to convert it to one
with the pointer thing at the end.
622
00:36:12,836 --> 00:36:13,286
I don't know.
623
00:36:13,286 --> 00:36:14,699
There, there's some, some thought
624
00:36:14,699 --> 00:36:22,398
So if I was a, although but yeah, no
that, that seems like a decent enough
625
00:36:22,398 --> 00:36:28,768
chunk of the problem to be a good step
forward because I presume that if I was
626
00:36:28,768 --> 00:36:34,708
importing a C library, sorry, c plus
library from rust, most of the time I
627
00:36:34,708 --> 00:36:40,708
would be initializing the objects rather
than essentially receiving an object
628
00:36:40,708 --> 00:36:43,618
that was created in the library itself.
629
00:36:43,768 --> 00:36:45,718
So no, that's really interesting.
630
00:36:46,168 --> 00:36:48,238
How does it change like that happen?
631
00:36:49,048 --> 00:36:49,918
It must be.
632
00:36:51,173 --> 00:36:53,543
This is a little bit about how
the committee works, but there
633
00:36:53,543 --> 00:36:59,353
must be years of deliberation for
things like this to make progress.
634
00:37:00,353 --> 00:37:07,343
With the committee there's a lot of
formalisms and structure and all these
635
00:37:07,343 --> 00:37:11,083
kinds of things, people frequently get
defeated by it because it's just like
636
00:37:11,113 --> 00:37:12,463
too overwhelming, too complicated.
637
00:37:12,463 --> 00:37:15,763
But if you understand it, there
are tricks that you can do.
638
00:37:16,303 --> 00:37:18,863
So here's the trick that we're
gonna do or we're gonna attempt,
639
00:37:18,863 --> 00:37:20,123
we'll see if it actually works.
640
00:37:20,153 --> 00:37:23,763
So right now, no new features
are allowed for C++ 26,
641
00:37:24,173 --> 00:37:24,443
right?
642
00:37:24,443 --> 00:37:25,733
It's already been stamped.
643
00:37:25,943 --> 00:37:27,143
It's going out to the national
644
00:37:27,143 --> 00:37:29,393
bodies for ballot at this point.
645
00:37:29,793 --> 00:37:32,613
And now we deal with what's
called National body comments.
646
00:37:33,543 --> 00:37:36,753
So every national body can say,
okay, we released this, we got
647
00:37:36,753 --> 00:37:39,813
this spec, and we have a comment
about this, a comment about this.
648
00:37:39,843 --> 00:37:42,603
And these are usually
comments about bug fixes.
649
00:37:42,603 --> 00:37:45,093
You can never say add a
new feature with a comment.
650
00:37:45,903 --> 00:37:49,793
And and this is a new feature in c
plus 26 is trivially relocatable thing.
651
00:37:50,363 --> 00:37:53,608
And so what I'm planning on
doing is making a national body
652
00:37:53,608 --> 00:37:58,708
comment for the us, which says
that we got our primitive wrong.
653
00:37:59,248 --> 00:38:04,048
The trivially relocate function is not
actually the simplest way to express
654
00:38:04,048 --> 00:38:08,348
this primitive like basis operation
for trivially relocatable types.
655
00:38:08,918 --> 00:38:11,558
It's this other thing, which
is called start lifetime.
656
00:38:11,558 --> 00:38:18,848
At and through this bug fixing
process, I'm hopeful we'll be able
657
00:38:18,848 --> 00:38:20,918
to say, oh yeah, that was a mistake.
658
00:38:21,188 --> 00:38:25,688
And so before se LS plus 26 ships,
we're going to have this new basis
659
00:38:25,688 --> 00:38:30,158
operation and that will unlock this
rust interop thing, but also solves
660
00:38:30,158 --> 00:38:32,678
another problem that people had
with the feature, which was that
661
00:38:32,978 --> 00:38:36,248
it didn't work with re alec where
you basically have an existing buffer
662
00:38:36,248 --> 00:38:39,038
that you're expanding and sometimes
it can expand at the same place.
663
00:38:39,398 --> 00:38:44,178
So I'm hopeful that we can get this to
happen, but yeah we're using this national
664
00:38:44,178 --> 00:38:46,068
body comment process to, to slip it in.
665
00:38:46,308 --> 00:38:48,533
Otherwise we're gonna
have to wait for C++ 29.
666
00:38:50,013 --> 00:38:50,883
I am curious.
667
00:38:50,883 --> 00:38:51,483
I'll watch.
668
00:38:51,513 --> 00:38:54,723
I think it'll be fascinating because
especially it's almost, there's always
669
00:38:54,723 --> 00:39:00,843
a meta discussion as well, but the
committee processes are challenging.
670
00:39:00,873 --> 00:39:05,763
A lot of people don't really have,
the stamina or it, 'cause everyone
671
00:39:05,763 --> 00:39:09,063
is so emotionally involved because
they wouldn't be there if they
672
00:39:09,063 --> 00:39:13,483
didn't think that things
could move forward or improve.
673
00:39:14,173 --> 00:39:16,843
And they've got this great idea that
they've been working on for years.
674
00:39:16,843 --> 00:39:21,133
They have a working implementation
before they even start proposing it.
675
00:39:22,123 --> 00:39:23,743
And now you're telling me
you gotta, I gotta wait.
676
00:39:23,743 --> 00:39:26,203
Like I gotta get, it's, yeah.
677
00:39:26,203 --> 00:39:28,208
I can just imagine that if I was.
678
00:39:28,733 --> 00:39:32,243
Doing this out of love or something
that there's no way I would
679
00:39:32,243 --> 00:39:36,593
be able to last a five to 10
years to get new things through.
680
00:39:36,623 --> 00:39:41,453
I was looking at one time, or I
think it was concepts, how there were
681
00:39:41,453 --> 00:39:47,063
multiple implementations and different
ideas about the way that could work.
682
00:39:47,063 --> 00:39:53,483
And but then again for something as
impactful as making a change to one
683
00:39:53,483 --> 00:39:56,663
of the most fundamental programming
languages in the world maybe
684
00:39:56,663 --> 00:39:59,093
waiting five years isn't very long.
685
00:39:59,098 --> 00:40:03,898
Like, I mean, uh, C++
is, um, is everywhere.
686
00:40:04,133 --> 00:40:07,703
And so it's extremely fundamental
and it's extremely important.
687
00:40:07,703 --> 00:40:12,653
The stakes are very, very high, and
so it makes sense to take things slow.
688
00:40:15,398 --> 00:40:16,253
I, I think so.
689
00:40:16,253 --> 00:40:20,603
And I think that's one of its
particular charisms is that.
690
00:40:21,038 --> 00:40:24,698
It is generally a slow moving
language, not as slow as C
691
00:40:24,818 --> 00:40:26,228
although C is speeding up.
692
00:40:26,468 --> 00:40:28,928
But you only can take on so
much new stuff at a time.
693
00:40:28,928 --> 00:40:34,298
And I think actually in my opinion, c
plus has grown too fast for its own good.
694
00:40:34,898 --> 00:40:37,628
We've hit some kind of tipping point
to where the complexity is more of
695
00:40:37,628 --> 00:40:39,488
a problem than it was a solution.
696
00:40:40,008 --> 00:40:42,018
And I don't know how to reverse that
697
00:40:42,128 --> 00:40:45,688
I think may maybe, human bias or
something, but it's much easier to add
698
00:40:45,688 --> 00:40:50,628
an extra feature, like an extra box to
the checklist or like the feature list.
699
00:40:50,838 --> 00:40:56,103
But, taking things away
is really is much harder.
700
00:40:57,043 --> 00:40:59,133
Just imagine saying,
actually we'll cut that out.
701
00:40:59,433 --> 00:41:00,693
Is essentially impossible.
702
00:41:00,793 --> 00:41:05,823
More generally than C++, but it's like
any sort of product, for example, software
703
00:41:05,823 --> 00:41:11,373
things, software products in general, I
think have this tendency to grow until
704
00:41:11,373 --> 00:41:12,468
they collapse under their own weight.
705
00:41:13,468 --> 00:41:14,518
Yeah, I think so.
706
00:41:14,578 --> 00:41:18,128
Also if you look at it from like
a company perspective let's say
707
00:41:18,128 --> 00:41:20,078
you've got a huge code base.
708
00:41:20,078 --> 00:41:22,913
I think the last quote I got
from Photoshop was like 79
709
00:41:22,913 --> 00:41:24,008
million lines of code, right?
710
00:41:24,008 --> 00:41:28,238
So we're talking a lot of code and
somebody from a standardization body
711
00:41:28,238 --> 00:41:33,718
says, Hey, you need to change, a
million lines of your code because we
712
00:41:33,718 --> 00:41:34,978
found a better way to do something.
713
00:41:36,298 --> 00:41:40,228
And the response is does that
add any value to my product?
714
00:41:40,473 --> 00:41:41,533
Do the customers care?
715
00:41:42,003 --> 00:41:42,663
no, not really.
716
00:41:43,943 --> 00:41:44,233
Yeah.
717
00:41:45,578 --> 00:41:48,878
Okay, so somebody up in the ivory tower
has decided there's a better way to
718
00:41:48,878 --> 00:41:52,868
do something and now I have to pay a
buttload of money for, that's not gonna
719
00:41:52,868 --> 00:41:54,368
actually have any tangible benefit.
720
00:41:54,938 --> 00:41:55,388
Nah.
721
00:41:55,988 --> 00:41:57,698
Rather keep the existing code.
722
00:41:57,698 --> 00:42:00,058
You wanna do something new
with the new codewe right?
723
00:42:00,248 --> 00:42:00,788
Great.
724
00:42:00,788 --> 00:42:05,768
But like that old code, if it's working
and it's doing its job like please don't
725
00:42:05,768 --> 00:42:06,968
make me have to do anything with it.
726
00:42:06,968 --> 00:42:07,178
'cause the
727
00:42:07,178 --> 00:42:08,198
scale is too big.
728
00:42:08,508 --> 00:42:09,828
It is just way too much.
729
00:42:11,718 --> 00:42:20,168
Are there any lessons for individuals that
you think if, who are navigating, while we
730
00:42:20,168 --> 00:42:25,768
come we've talked about Rust language, C++
language, you know, companies, but what
731
00:42:25,768 --> 00:42:29,428
about, uh, people and their own careers?
732
00:42:29,958 --> 00:42:31,818
Yeah, I think that's a
really good question.
733
00:42:31,818 --> 00:42:36,908
I think I can speak in
particular for C++ developers.
734
00:42:37,458 --> 00:42:40,508
For someone who's a C++ developer,
they're an expert in it.
735
00:42:40,568 --> 00:42:42,398
You know, they feel very
powerful in that language.
736
00:42:42,398 --> 00:42:45,638
And the idea of going to any other
language, you'd feel very weakened, right?
737
00:42:45,638 --> 00:42:47,198
Because you're just so
used to this language.
738
00:42:47,598 --> 00:42:51,408
If you're a c plus developer
you have a choice, right?
739
00:42:51,678 --> 00:42:56,118
You will definitely, no matter what
stage of your career, be able to program
740
00:42:56,118 --> 00:42:57,408
c plus for the rest of your career.
741
00:42:57,658 --> 00:42:59,188
This is not going away.
742
00:42:59,548 --> 00:42:59,698
There.
743
00:42:59,818 --> 00:43:00,928
Jobs are gonna be there.
744
00:43:01,408 --> 00:43:06,688
But it will be with a legacy language,
especially towards the end of your career,
745
00:43:06,688 --> 00:43:10,618
it's gonna be like, there are some FORTRAN
people today and they do their thing.
746
00:43:10,618 --> 00:43:11,698
There are some COBOL people.
747
00:43:11,818 --> 00:43:16,318
I don't think it'll be that bad in 20
years, but it'll be in that space, right?
748
00:43:16,918 --> 00:43:19,738
But just be okay with that if
that's what you want to do.
749
00:43:20,458 --> 00:43:22,918
If you're looking, if you wanna be.
750
00:43:24,073 --> 00:43:28,603
Where the innovation is happening,
then you're gonna have to take a
751
00:43:28,603 --> 00:43:31,783
different approach and you're gonna
have to look at things like Rust
752
00:43:31,843 --> 00:43:34,603
and Rust in particular right now, I
think is really important to look at.
753
00:43:35,083 --> 00:43:36,253
And don't be threatened by it.
754
00:43:36,703 --> 00:43:42,463
See, I, something that's not talked about
a lot is that rust is an outgrowth of C++.
755
00:43:42,933 --> 00:43:45,133
C++ is almost its granddaddy.
756
00:43:45,133 --> 00:43:47,053
People hate it when I
say that, but it's true.
757
00:43:47,503 --> 00:43:52,153
So many lessons that were learned
from C++ were incorporated in a rust,
758
00:43:52,153 --> 00:43:55,153
whether it's acknowledged or not,
it's just obvious in the design.
759
00:43:55,663 --> 00:44:01,033
And if you look at it like that,
it's, you can be proud of it, right?
760
00:44:01,113 --> 00:44:01,583
You're a C++.
761
00:44:02,023 --> 00:44:03,373
Look at all the stuff that
they learned from C++.
762
00:44:03,783 --> 00:44:04,513
That's great.
763
00:44:04,513 --> 00:44:07,943
All the stuff that I did to
help grow C++ or, or build C++
764
00:44:08,323 --> 00:44:10,873
knowledge in the community of
people that I'm, I'm, I'm with.
765
00:44:11,503 --> 00:44:13,483
This is a consequence of that.
766
00:44:13,483 --> 00:44:14,504
It's a benefit of it.
767
00:44:15,223 --> 00:44:17,053
And if you look at it like
that, it's not as threatening.
768
00:44:17,053 --> 00:44:18,373
It's not like an us versus them.
769
00:44:18,373 --> 00:44:19,153
It's more like.
770
00:44:19,528 --> 00:44:20,548
You know, good for them.
771
00:44:20,668 --> 00:44:24,018
You know, like, let me look into this
because this is the next step in C++'s
772
00:44:24,508 --> 00:44:28,948
growth is actually Rust it's the, you
wouldn't say next step in C++'s growth,
773
00:44:28,948 --> 00:44:33,508
but next step in growth for a systems
engineer is using the latest tech.
774
00:44:33,888 --> 00:44:35,448
And the same is true for AI, right?
775
00:44:35,448 --> 00:44:38,538
It's like another one of these
things is it's gonna be here, right?
776
00:44:38,538 --> 00:44:41,298
You're not gonna change
it and make it go away.
777
00:44:41,748 --> 00:44:45,928
But you can be part of the future
and what it's going to bring.
778
00:44:45,928 --> 00:44:50,098
And so I would recommend to
people to be open-minded about it.
779
00:44:50,198 --> 00:44:52,178
Check it out, try it in a real project.
780
00:44:52,398 --> 00:44:55,548
You want to seek that feeling
that so many people report that.
781
00:44:55,548 --> 00:44:59,388
Oh, I went and I used rust and I really
don't wanna use c plus anymore after that.
782
00:44:59,778 --> 00:45:01,458
You wanna seek that experience, right?
783
00:45:01,458 --> 00:45:03,798
Because then you can get it and you
can see where they're coming from
784
00:45:03,858 --> 00:45:05,438
and then, see where that takes you.
785
00:45:05,513 --> 00:45:07,463
But you gotta be open-minded, right?
786
00:45:07,463 --> 00:45:10,693
It's just gonna, you're gonna have to
try out some things and get past some
787
00:45:10,693 --> 00:45:13,093
biases and just say like, all right,
I'm gonna, I'm gonna give it a whirl.
788
00:45:13,458 --> 00:45:16,193
I think of Rust as a bit of
a spiritual successor to C++.
789
00:45:17,463 --> 00:45:25,628
The one funny thing actually is and
Rust has learned so much from systems
790
00:45:25,628 --> 00:45:32,838
programming experience over over several
decades, and it's as though we have
791
00:45:32,838 --> 00:45:37,688
taken the lessons around initialization
and destruction and just encoded that
792
00:45:37,688 --> 00:45:40,298
in the type system or into the compiler.
793
00:45:40,688 --> 00:45:44,558
There is this liberating feeling,
knowing that you are never going
794
00:45:44,558 --> 00:45:50,858
to need to worry about, I don't
know, deleting an object twice.
795
00:45:52,178 --> 00:45:57,638
It's just, oh, that's not a, that's not
a concern that I need to have perhaps.
796
00:45:57,638 --> 00:46:00,228
But another thing is maybe they front
load the concern because you know
797
00:46:00,228 --> 00:46:04,548
your design needs to be correct, but
also, isn't it so much better that
798
00:46:04,548 --> 00:46:09,858
you get told that there's a problem
early before you get told by your users
799
00:46:09,858 --> 00:46:13,338
that there's a problem or worse they
don't tell you 'cause they don't know.
800
00:46:13,338 --> 00:46:17,958
And they've got introduced some sort of
horrendous bug by the way that a lot of
801
00:46:17,958 --> 00:46:20,958
that stuff around C++ was accidental.
802
00:46:22,053 --> 00:46:25,543
I don't, I am not gonna be able to
find the reference, but grad whore
803
00:46:25,543 --> 00:46:31,543
is was talking I think it might have
been on Twitter that or saying that
804
00:46:31,543 --> 00:46:33,343
was not the original intent with Rust.
805
00:46:33,973 --> 00:46:38,293
The original intent was something
much more closer to go where you
806
00:46:38,353 --> 00:46:44,383
or I guess much more with a much
greater focus on concurrency.
807
00:46:45,463 --> 00:46:51,353
But then when it was adopted by
Mozilla, the Firefox group really
808
00:46:51,353 --> 00:46:57,723
wanted to essentially be zero cost
abstractions all the way down and had
809
00:46:57,723 --> 00:47:04,743
this very heavy, practical focus on
being as lean at runtime as possible.
810
00:47:05,373 --> 00:47:07,323
Because if Rust was to ever compete.
811
00:47:08,268 --> 00:47:11,228
It needed to be able it needed to shed.
812
00:47:11,228 --> 00:47:16,288
Its its runtime, which it had at one, very
pre 1.0 like it's now over a decade ago.
813
00:47:16,348 --> 00:47:21,988
But it's a slight accident of history,
but also really positive that the
814
00:47:21,988 --> 00:47:24,718
language was incubated in production.
815
00:47:26,548 --> 00:47:30,298
The idea that we could, we were
creating a programming language to
816
00:47:30,298 --> 00:47:38,068
be able to work in the context of a
c plus program to enable multi-core.
817
00:47:38,428 --> 00:47:41,968
And that was a very, like a
multimillion lines of code
818
00:47:41,968 --> 00:47:45,698
base with built by many teams.
819
00:47:45,698 --> 00:47:52,283
And so all of those features were
like part of, it's, part of it
820
00:47:52,288 --> 00:47:56,778
how, part of how it grew up out
of a hobby project originally.
821
00:47:57,858 --> 00:48:03,318
I think it would be like, this has just
been such a really nice arc all the way.
822
00:48:03,438 --> 00:48:05,868
And thank you so much for
sharing your thoughts.
823
00:48:05,868 --> 00:48:08,928
Has there been anything else that's
popped into your mind as we've
824
00:48:08,928 --> 00:48:13,398
been chatting that you're like, oh,
I should tell people about that?
825
00:48:14,398 --> 00:48:18,913
I guess probably the biggest thing is
check out Zengar for doing c plus interop.
826
00:48:19,303 --> 00:48:25,603
The, it's way less known than it
deserves as a c plus interop layer.
827
00:48:25,603 --> 00:48:26,683
Like very interesting.
828
00:48:27,103 --> 00:48:28,123
That's probably the biggest thing that
829
00:48:28,233 --> 00:48:28,523
Okay.
830
00:48:28,728 --> 00:48:29,208
Fantastic.
831
00:48:29,238 --> 00:48:32,598
I am so looking forward to your
talk in New Zealand next month.
832
00:48:32,598 --> 00:48:36,958
I am just, I feel so incredibly honored
that you have decided that you accepted
833
00:48:36,958 --> 00:48:39,718
our offer to, to come down here.
834
00:48:39,928 --> 00:48:41,488
And I hope that you have a very.
835
00:48:42,133 --> 00:48:44,473
Enjoyable experience in the country.
836
00:48:44,803 --> 00:48:50,173
Until then, I hope that you also actually
enjoy the process of preparing for a talk.
837
00:48:50,243 --> 00:48:54,713
I know that you'll have a very receptive
audience, so thank you both for sharing
838
00:48:54,713 --> 00:48:56,943
your time and sharing your expertise.
839
00:48:57,033 --> 00:48:57,663
So thanks, David.
840
00:48:58,663 --> 00:48:59,533
Oh, thank you so much.
841
00:48:59,533 --> 00:49:04,903
I am so psyched about the conference,
so I can't wait to be there.