r/programming • • Jan 22 '19

Pharo 7.0 released!

https://pharo.org/news/pharo7.0-released
378 Upvotes

137 comments sorted by

View all comments

Show parent comments

5

u/Randolpho Jan 22 '19

C++ is a great language, but it would be a much better language if it would just abandon C already. I mean, sure, maintain the ability to bind to C libraries and other sorts of machine-code level integrations, just stop with backwards compatibility at the language level.

11

u/ObscureCulturalMeme Jan 22 '19 edited Jan 22 '19

So what change would you like to see that maintains...

I mean, sure, maintain the ability to bind to C libraries and other sorts of machine-code level integrations

...that degree of ABI compatibility, while...

just stop with backwards compatibility at the language level.

...somehow achieving this? What, exactly, would you like to drop?

A lot of people complain about C arrays being no more than pointers. Sure, that could be dropped from C++, but you no longer get to binary link against C libraries.

6

u/Randolpho Jan 22 '19

Mostly, I'd love to see header files and preprocessing macros go away.

I'd also love stronger typing -- C plays really loose with typing.

Basically I want C# from a general namespacing/scoping standpoint, but with C++ allocation semantics and runtime libraries, native compiliation by default, and functions as first class citizens.

3

u/ObscureCulturalMeme Jan 23 '19

Mostly, I'd love to see header files and preprocessing macros go away.

Okay, fair enough. Wouldn't break binary compatibility.

I'd also love stronger typing -- C plays really loose with typing.

C++ already has stronger typing than C. What, exactly, do you want changed about C++ in this regard? And how is it supposed to be binary compatible with C?

You've tossed out some very attractive buzzwords -- stronger typing! we all want stronger typing! -- but you've given no specific examples, nor indication that you understand that these are very nearly impossible to implement while also still linking against native C.

It's possible to bake a lot of information into name mangling, so it's very likely that stronger link-time analysis could be performed when linking C++ with other C++. That would be possible (with some trade-offs that not everyone would necessarily enjoy), and things like that already have been done, and continue to improve. But doing that when linking against C, nope.

The C++ standards people (who would also be the ones implementing the compilers and linkers and libraries) recognize that binary compatibility with C is simultaneously C++'s biggest strength and its biggest weakness. If they could have let you eat the cake and keep it too, it would have already been done. (I know this because I was one of those people for a time.)

Basically I want [a bunch of stuff that can't happen without breaking the ABI, and no suggestions as to how this would possibly happen].

You'd have to change C as well to get any of that. In fact, you'd have to change it so much that it wouldn't be binary compatible with older versions of itself. At that point, you might as well just do a new language yourself, implement what features you want, and name it after your favorite beer/taco/bourbon/moon.

Don't name it Beer Taco Bourbon Moon, though. That would be weird.

4

u/[deleted] Jan 23 '19

What binary compatibility?

C++ with its "every compiler use different name mangling" is the opposite of binary compatibility.

→ More replies (0)