Live data from Hacker News

Bjarne Stroustrup Quotes

stroustrup.com

31–40 of 173 posts

Re: Bjarne Stroustrup Quotes

#31
post #20

I'll see you Bjarne Stroustrup, and raise you Alan Kay, "Actually I made up the term "object-oriented", and I can tell you I did not have C++ in mind." https://en.wikiquote.org/wiki/Alan_Kay

It's almost as if language and meaning evolve in the minds of people in strange ways.

Re: Bjarne Stroustrup Quotes

#32
Section 10.7 of "The Design and Evolution of C++" has some good ones from the early 90s:

"When (not if) garbage collection becomes available, we will have two ways of writing C++ programs."

"I suspect that a garbage collection scheme can be concocted that will work with (almost) every legal C++ program, but work even better when no unsafe operations are used."

"I am under no illusion that building an acceptable garbage collection mechanism for C++ will be easy - I just don't think it is impossible. Consequently, given the number of people looking at the problem several solutions will soon emerge."

Re: Bjarne Stroustrup Quotes

#33

Earlier quoted context omitted.

honestly, no one cares about splitting that hair. Most valid C programs will compile in C++ and believe it or not, binary logic is not the only logic humans are capable of.

Almost every C program does `int *c = malloc(sizeof(int) *10)` or similar, which has always been invalid C++.

I believe most compilers have switches to allow this. The real issue you might run into that can't be worked around easily is if the C source uses a C++ keyword as an identifier.

Re: Bjarne Stroustrup Quotes

#34

Section 10.7 of "The Design and Evolution of C++" has some good ones from the early 90s: "When (not if) garbage collection becomes available, we will have two ways of writing C++ programs." "I suspect that a garbage collection scheme can be concocted that will work with (almost) every legal C++ program, but work even better when no unsafe operations are used." "I am under no illusion that building an acceptable garba…

Well, we now have garbage collection. Just not tracing garbage collection.

Re: Bjarne Stroustrup Quotes

#35
post #9

Language design is a curious mixture of grand ideas and fiddly details I hadn't heard this last one before, but it's SO right ... I always wondered why JS and PHP and Perl got so many details "wrong" (e.g. with Perl, one definition of "wrong" is that Perl 6 / Raku didn't make the same design choice) Turns out there's an avalanche of details, and they interact in many ways! Python did better, but I strongly argue both…

Can you explain how you think strings should work?

I think the main alternative design is to treat strings like in Rust or Go.

The problem with the “array of code points” idea is that you end up with the most general implementation, which is a UTF-32 string, and then you end up with the fastest implementation, which is a UTF-8 string, and maybe throw in UCS-2 for good measure. These all have the same asymptotic performance characteristics, but allow ASCII strings (which are extremely common) to be stored with less memory. The cost is that now you have two or three different string representations floating around. This approach is used by Python and Java, for example.

The Rust / Go approach is to assume that you don’t need O(1) access to the Nth code point in a string, which is probably reasonable, since that’s rarely necessary or even useful. You get a lot of complexity savings from only using one encoding, and the main tradeoff is that certain languages take 50% more space in memory.

Python and Java both date back to an era where fixed-width string encodings were the norm.

Re: Bjarne Stroustrup Quotes

#36

Section 10.7 of "The Design and Evolution of C++" has some good ones from the early 90s: "When (not if) garbage collection becomes available, we will have two ways of writing C++ programs." "I suspect that a garbage collection scheme can be concocted that will work with (almost) every legal C++ program, but work even better when no unsafe operations are used." "I am under no illusion that building an acceptable garba…

Actually, these quotes have become outdated by the language itself! ... in favor of this quote:

> I don't like garbage. I don't like littering. My ideal is to eliminate the need for a garbage collector by not producing any garbage. That is now possible.

See this question:

https://stackoverflow.com/q/147130/1593077

and this answer (of mine):

https://stackoverflow.com/a/48046118/1593077

Re: Bjarne Stroustrup Quotes

#37
post #29

"There are only two kinds of languages: the ones people complain about and the ones nobody uses". He is right on this one. Pretty much in every discussion about Programming Languages people write how good Rust is and complain about how bad C++ is but the reality is, C++ it's one of the most used languages in the world. This quote could be a very harsh reply to Rust vs C++.

No, it could be a very stupid reply to Rust vs C++ since people do write in Rust. Bigger programs get written in it all the time and - what a surprise - people who use it have things they are annoyed about, which is why it gets improved. To me this is one of the most stupid things he's ever uttered on one hand and the most useful one on the other. Cause it can be used to remind people that there's always trade-offs,…

FWIW, I think Bjarne and other C++ magnates have a plan for eating Rust's lunch by allowing for "safe"/"unsafe" within C++.

Re: Bjarne Stroustrup Quotes

#38
post #3

"We didn't have time for that." (Bjarne Stroustrup, before an invited talk, Cambridge Computer Lab) (in response to my complaint to him that hastables again hadn't been included in the most recent standard at the time.)

Yeah, so many programmers had to find the time to implement them or find an STL library with the stuff.

The really important stuff was printing with "<<", or whatever ...

Re: Bjarne Stroustrup Quotes

#39
post #29

Earlier quoted context omitted.

No, it could be a very stupid reply to Rust vs C++ since people do write in Rust. Bigger programs get written in it all the time and - what a surprise - people who use it have things they are annoyed about, which is why it gets improved. To me this is one of the most stupid things he's ever uttered on one hand and the most useful one on the other. Cause it can be used to remind people that there's always trade-offs,…

FWIW, I think Bjarne and other C++ magnates have a plan for eating Rust's lunch by allowing for "safe"/"unsafe" within C++.

Sounds like something they could try. We'll see what happens. It's not like I expect C++ to "roll over" and just declare that they don't care anymore if people use the language.

Re: Bjarne Stroustrup Quotes

#40

Earlier quoted context omitted.

Can you explain how you think strings should work?

I think the main alternative design is to treat strings like in Rust or Go. The problem with the “array of code points” idea is that you end up with the most general implementation, which is a UTF-32 string, and then you end up with the fastest implementation, which is a UTF-8 string, and maybe throw in UCS-2 for good measure. These all have the same asymptotic performance characteristics, but allow ASCII strings (wh…

Thanks for your response. Personally I fall into the "strings are arrays of bytes" camp (which is also shared by Go). A difference between my view and that of the Go designers is that I don't feel that it is important to support Unicode by default and am perfectly happy to assume that every character corresponds to a single byte. Obviously that makes internationalization harder, but the advantage is that strings are much simpler to reason about. For example, the number of characters in the string is simply the length of the string. I would be fine having a separate Unicode string type in the standard library for those instances when you really need Unicode; this design makes the common case much simpler at the expense of making the rare case harder. I also don't see that mutability is such a huge deal unless you absolutely insist that your language support string interning.
Post reply on HN