Live data from Hacker News

Bjarne Stroustrup Quotes

stroustrup.com

71–80 of 173 posts

Re: Bjarne Stroustrup Quotes

#71
post #44

Earlier quoted context omitted.

"strings are arrays of bytes" combined with the assumption that "characters are a single byte" sounds basically the same as the "array of code points" that the parent comment is disagreeing with

Code points are not bytes.

Sure, but if you're insisting that the string be represented as one byte per character, you end up with the exact same properties with "array of code points" and "array of bytes"

Re: Bjarne Stroustrup Quotes

#72

"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++.

I think you would have a very hard time defending the claim that 'nobody uses Rust,' given its current adoption trend in major technology companies like Microsoft and its integration in software projects like the Linux kernel.

Re: Bjarne Stroustrup Quotes

#73
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++.

I mean, sure, Bjarne calls his proposed way forward "safety profiles".

Most fundamentally, this completely misunderstands the nature of the problem. This is a technical change, but the most important problem C++ has is cultural. So, they're not even addressing the right problem. In his original talk about this Bjarne even repeatedly describes his approach as a "strategy" which practically begged someone to say "Culture Eats Strategy For Breakfast" but no-one did.

But let's imagine that C++ culture magically is fixed by pixies or whatever, leaving only technical problems, which safety profiles could address. The next big problem is that Rust's safety is compositional. The many different kinds of "safety" delivered via Bjarne's "safety profiles" don't compose, safety A + safety B = no safety. So this makes it largely useless from a software engineering point of view.

Once you've cleared these two fundamental obstacles you're back to more mundane limitations like timing. Rust 1.0 shipped in 2015. There are teams out there already with many years of Rust experience in practice. But Bjarne's "Safety Profiles" aren't available in your C++ compiler today, and won't be for years to come, perhaps many years. Are you confident that starting this far behind the pack will be OK?

Re: Bjarne Stroustrup Quotes

#74
post #52

Earlier quoted context omitted.

Can you explain how you think strings should work?

Unfortunately, strings cross at least 3 different problems: * charset encoding. Cases worth supporting include Ascii, Latin1, Xascii, WeirdLegacyStatefulEncoding, WhateverMyLocaleSaysExceptNotReally, UTF8, UTF16, UCS2, UTF32, and sloppy variants thereof. Note that not supporting sloppiness means it is impossible to access a lot of old data (for example, `git` committers and commit messages). Note that it is impossibl…

I agree with all of this. I remember way back when i was doing CORBA programming (argh!) thinking "can these stupid bastards not specify a simple string class??" To have the most commonly used data type be so complicated makes me think we have got things deeply wrong somewhere.

Re: Bjarne Stroustrup Quotes

#75
post #68

Earlier quoted context omitted.

Encoding might not be the whole issue, but "Rust mandates that the 'string' type must only contain valid UTF-8, which is incompatible with every operating system in the world" is the reason why OsString is a separate type.

The only encoding which is compatible with "every operating system in the world" is no enforced encoding at all, and you can do very little "string-like" operations with such a type. Even Python, well-known for being a very usable language, distinguishes between strings (which are unicode, but not utf-8 necessarily) and bytes, which you need to use if you're interacting directly with the OS. The only real difference…

> The only encoding which is compatible with "every operating system in the world" is no enforced encoding at all, and you can do very little "string-like" operations with such a type.

People who like "list of Unicode code points" string types in languages like Rust and Python 3 always say this, but I'm never sure what operations they think are enabled by them.

In the "bag of bytes that's probably UTF-8" world, you can safely concatenate strings, compare them for equality, search for substrings, evaluate regular expressions, and so on. In the "list of code points" world, you can do... what else exactly?

Many things that users think of as single characters are composed of multiple code points, so the "list of code points" representation does not allow you to truncate strings, reverse them, count their length, or do really anything else that involves the user-facing idea of a "character". You can iterate over each of the code points in a string, but... that's almost circular? Maybe the bytes representation is better because it makes it easier to iterate over all the bytes in a string. Neither of those is an especially useful operation on its own.

Re: Bjarne Stroustrup Quotes

#76
post #28

"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++.

If you think nobody complains about Rust then you haven't visited HN much recently ;). Heck, Bjarne Stroustrup himself has recently taken to complaining about Rust in papers and talks (though most recently he's taken to referring to it without naming names).

There's a noticeable difference between what you get from somebody like Barry Revzin, who understands C++ and Rust well and has very specific criiques, and from people like Bjarne or Herb who seem to be relying on superficial impressions at best.

Re: Bjarne Stroustrup Quotes

#77

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

for cyclic object graphs you build your own GC, no matter if you call it such, or you leak memory.

Re: Bjarne Stroustrup Quotes

#78

Earlier quoted context omitted.

I don't find it at all insightful or humorous. (I hope you don't think it's genuine)

> I don't find it at all insightful or humorous. Humor isn't an absolute. I find it funny because if Stroustrup had tried he probably couldn't have made a language with more footguns, there are so many things in there that require a lot of discipline not to use (or overuse). At the same time it was a supremely useful language that allowed for much better abstraction than C ever did but it definitely came with a price…

> not real?

real genuine Eric S Raymond humor, yes.

Re: Bjarne Stroustrup Quotes

#79

Earlier quoted context omitted.

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.

    #define new new_

Re: Bjarne Stroustrup Quotes

#80
post #56

Earlier quoted context omitted.

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…

>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. Even as a native English speaker, I'm extremely uncomfortable with the idea that we're going to make software even more difficult to internationalize than it already is by using completely separate…

If you give an input box to an American I promise you an emoji will find it's way into it no matter what it's for.
Post reply on HN