Bjarne Stroustrup: C++

Bjarne Stroustrup · 9,764 词 · 查看原文 ↗
技术与编程音乐与艺术AI 与机器学习历史与文明心理与人性
📋 章节目录

暂无章节信息

🔑 关键词
codelanguageprogrammingdonrulestypelanguagesgoingbetterabstractionstuffsystemstypesdidnfeaturessaiddesignmachinecouldngot
💬 精彩语录
"problem, explained possible solutions. It was not a complete design. A group in University of Indiana,"
问题,解释了可能的解决方案。这不是一个完整的设计。印第安纳大学的一个研究小组,
— Bjarne Stroustrup (1:15:47.840)
"basically otherwise we'll do it ourselves. And we know you can do it better. So through a combination"
基本上否则我们就自己做。我们知道您可以做得更好。所以通过组合
— Bjarne Stroustrup (1:19:51.120)
"relatively slow. And so he shows in real time how he writes Pong starting with fairly straightforward"
相对较慢。所以他实时展示了他如何从相当简单的开始编写 Pong
— Bjarne Stroustrup (20:46.400)
"looking for. I'll be looking for some tricks that correlate with bugs and elsewhere. And I have tried"
寻找。我将寻找一些与错误和其他地方相关的技巧。我已经尝试过
— Bjarne Stroustrup (33:03.360)
"when you see it. And I'm not sure you can describe it in words, except vaguely through guidelines and"
当你看到它时。我不确定你能用语言描述它,除非通过指导方针和
— Bjarne Stroustrup (36:12.240)
🎙️ 完整对话(585 条)
Lex Fridman (1:11:49.200)
time predicates. Do you have the properties I need? So it specifies the requirements of the code
时间谓词。你们有我需要的房产吗?所以它指定了代码的要求
Lex Fridman (1:11:56.320)
on the parameters that it gets. It's very similar to types actually. But operating in the space of
关于它获得的参数。它实际上与类型非常相似。但在空间中操作
Lex Fridman (1:12:05.280)
concepts. Concepts. The word concept was used by Alex Stefanov, who is sort of the father of generic
概念。概念。概念这个词是由亚历克斯·斯特凡诺夫(Alex Stefanov)使用的,他可以说是泛型之父
Lex Fridman (1:12:15.200)
programming in the context of C++. There's other places that use that word, but the way we call
在 C++ 环境中进行编程。还有其他地方使用这个词,但我们调用的方式
Lex Fridman (1:12:23.520)
it generic programming is Alex's. And he called them concepts because he said they are the sort
通用编程是 Alex 的。他称它们为概念,因为他说它们是那种
Bjarne Stroustrup (1:12:29.040)
of the fundamental concepts of an area. So they should be called concepts. And we've had
区域的基本概念。所以它们应该被称为概念。而我们已经有过
Bjarne Stroustrup (1:12:34.720)
concepts all the time. If you look at the KNR book about C, C has arithmetic types and it has
一直以来的概念。如果你看一下关于 C 的 KNR 书,C 有算术类型,并且有
Bjarne Stroustrup (1:12:45.760)
integral types. It says so in the book. And then it lists what they are and they have certain
整数类型。书上是这么说的。然后它列出了它们是什么以及它们有一定的
Bjarne Stroustrup (1:12:52.480)
properties. The difference today is that we can actually write a concept that will ask a type,
特性。今天的不同之处在于,我们实际上可以编写一个会询问类型的概念,
Lex Fridman (1:12:59.200)
are you an integral type? Do you have the properties necessary to be an integral type?
你是积分型吗?您是否具有成为整型所需的属性?
Lex Fridman (1:13:05.200)
Do you have plus, minus, divide and such? So maybe the story of concepts, because I thought
有加、减、除之类的吗?所以也许是概念的故事,因为我认为
Bjarne Stroustrup (1:13:15.200)
it might be part of C++11. C O X or whatever it was at the time. What was the, why didn't it,
它可能是 C++11 的一部分。 C O X 或当时的任何东西。那是什么,为什么没有,
Bjarne Stroustrup (1:13:25.680)
what, like what we'll, we'll talk a little bit about this fascinating process of standards,
就像我们将要讨论的那样,我们将讨论一下这个令人着迷的标准过程,
Bjarne Stroustrup (1:13:30.560)
because I think it's really interesting for people. It's interesting for me,
因为我认为这对人们来说真的很有趣。这对我来说很有趣,
Lex Fridman (1:13:34.000)
but why did it take so long? What shapes did the idea of concepts take?
但为什么花了这么长时间?概念的想法采取了什么形式?
Lex Fridman (1:13:41.760)
What were the challenges? Back in 87 or thereabouts. 1987?
面临哪些挑战?回到87年左右。 1987 年?
Bjarne Stroustrup (1:13:49.120)
Well, 1987 or thereabouts when I was designing templates, obviously I wanted to express the
嗯,1987 年左右,当我设计模板时,显然我想表达
Bjarne Stroustrup (1:13:54.960)
notion of what is required by a template of its arguments. And so I looked at this and basically
其参数模板所需内容的概念。所以我看了这个基本上
Bjarne Stroustrup (1:14:03.920)
for templates, I wanted three properties. I wanted to be very flexible. It had to be able to express
对于模板,我想要三个属性。我想要变得非常灵活。它必须能够表达
Bjarne Stroustrup (1:14:14.000)
things I couldn't imagine because I know I can't imagine everything. And I've been suffering from
我无法想象的事情,因为我知道我无法想象一切。而我一直在承受着
Bjarne Stroustrup (1:14:20.480)
languages that try to constrain you to only do what the designer thought good. Didn't want to
Bjarne Stroustrup (1:14:27.600)
do that. Secondly, it had to run faster, as fast or faster than handwritten code. So basically,
Bjarne Stroustrup (1:14:35.920)
if I have a vector of T and I take a vector of char, it should run as fast as you built a vector
Bjarne Stroustrup (1:14:43.520)
of char yourself without parameterization. And thirdly, I wanted to be able to express
Lex Fridman (1:14:52.480)
the constraints of the arguments, have proper type checking of the interfaces.
Lex Fridman (1:15:01.680)
And neither I nor anybody else at the time knew how to get all three. And I thought for C++,
Bjarne Stroustrup (1:15:09.360)
I must have the two first. Otherwise, it's not C++. And it bothered me for another couple of
Bjarne Stroustrup (1:15:17.040)
decades that I couldn't solve the third one. I mean, I was the one that put function argument
Bjarne Stroustrup (1:15:23.600)
type checking into C. I know the value of good interfaces. I didn't invent that idea. It's very
Bjarne Stroustrup (1:15:29.840)
common, but I did it. And I wanted to do the same for templates, of course, and I couldn't.
查看原始文字稿 ↗
🔗 相关节目