News for hackers. Stuff that matters.
Re:Rust 2019 and beyond: limits to some growth by CJefferson on Wednesday December 26, 2018 @05:40PM (#18765526)
I can't agree more with this. I am a long time c++ dev, been to c++ committee meetings. The language is too complicated and inconsistent, and that is now I believe unfixable. I believe no one understands it. New features keep arriving, but you still have to learn everything that came before, for older codebases.

For example, {} style initalisers were added to simplify and "unify" things. Except to make a vector of length 3 you still need to use the old style (3) notation. So now there is just one more thing to learn.

It is much easier to add "one more thing" to a language than it is to later take it out.

Re:Rust 2019 and beyond: limits to some growth by blattimwind on Wednesday December 26, 2018 @06:03PM (#18765643)
I've been dabbling in some Rust lately and as a long time mostly-C++-and-Python-and-some-Java dev I've found it relatively easy to get started with it. Sure, a lot of things are different (e.g. struct+impl vs. classes), many clearly better, some that may/may not be better just different, but overall it seems to me like Rust is relatively easy to pick up coming from C++.

And C++ is usually way uglier and far more complicated. I'm currently reviewing a bunch of code using bleeding edge language features and it is extremely difficult to understand what the code is supposed to do and what it might be doing.

The age of multi-vendored languages like C or C++ for systems programming might be coming to an end. I'd wager this is actually a good thing.

Re:Rust 2019 and beyond: limits to some growth by the_duke on Wednesday December 26, 2018 @06:31PM (#18765797)
I was drawn to Rust because, behind the apparent complexity of the borrow checker, the language is/was actually very simple and easy to understand.

I have been using Rust extensively for over 2 years.

In those two years, the language complexity has increased substantially. It's already at a stage where I'm worried about losing track.

Also, there is quite a large amount of changes in the pipeline that were already accepted but are either not finished or not implemented yet. All of those can/will have a significant impact on idiomatic code and API design and will increase the complexity burden:

* specialization * generic associated types (a simple form of higher kinded types) * async/await + generators * existential types * const generics ...

So I do believe Rust needs to slow down considerably and get much stricter with accepting new features. Both to not overwhelm the existing userbase and to not make the language another C++ in terms of complexity.

Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @06:43PM (#18765889)
One thing that’s come out of this years’ posts by various people is that, after those features have landed, people generally do want things to be done. These features shore up major weaknesses in the language for various domains, but there’s not really things not in that list that many people still extremely desire.
Re:Rust 2019 and beyond: limits to some growth by the_duke on Thursday December 27, 2018 @03:13PM (#18772238)
Totally agree that the features I mentioned address shortcomings.

And while I think Rust could do just fine without GATs, specialization is something I'd really hope for.

People will never be satisfied though and always ask for new features.

Re:Rust 2019 and beyond: limits to some growth by z3phyr on Thursday December 27, 2018 @12:14AM (#18767506)
Try Zig too. Its on the stage when rust was 0.4 alpha, but it has some very great ideas and its really simple
Re:Rust 2019 and beyond: limits to some growth by pjmlp on Wednesday December 26, 2018 @06:18PM (#18765718)
History has proven that system programming language winners come with an OS/platform to cimment their advantage over others.

So I don't agree that the age of "The age of multi-vendored languages like C or C++ for systems programming might be coming to an end.", unless you mean we will managed to get rid of all OSes written in them, specially UNIX flavours or GPGPU libraries.

It would be nice, but it won't happen until the next big hardware revolution like Quantic computers being developed in Q# for example.

Re:Rust 2019 and beyond: limits to some growth by amelius on Wednesday December 26, 2018 @08:52PM (#18766605)
> The age of multi-vendored languages like C or C++ for systems programming might be coming to an end. I'd wager this is actually a good thing.

That's because you can't make money writing compilers anymore.

Re:Rust 2019 and beyond: limits to some growth by SSLy on Thursday December 27, 2018 @08:14AM (#18769230)
Anyone knows if intel parallel studio is profitable?
Re:Rust 2019 and beyond: limits to some growth by mroche on Thursday December 27, 2018 @11:43AM (#18770554)
Used over in HPC here and their cluster version (which bundles Intel MPI) is several thousand dollars. Aren’t it’s tools also the core of Clear Linux? Or does that default to GCC/Clang?
Re:Rust 2019 and beyond: limits to some growth by kentrado on Thursday December 27, 2018 @03:04AM (#18768189)
Why?
Re:Rust 2019 and beyond: limits to some growth by dullgiulio on Thursday December 27, 2018 @04:33AM (#18768524)
LLVM and GCC are dominating the space and pretty much killed propretary compilers.
Re:Rust 2019 and beyond: limits to some growth by baq on Thursday December 27, 2018 @05:59AM (#18768810)
Rust both greatly benefits from and is encumbered by LLVM. Maybe there’s room for a different LLVM-like or perhaps LLVM compatible project.
Re:Rust 2019 and beyond: limits to some growth by dullgiulio on Thursday December 27, 2018 @06:50AM (#18768942)
Interesting, what do you think makes is encumbered by LLVM?

I thought that sqeezing MIR in the middle Rust could get both Rust-specific transformations and then benefits from the LLVM generic code optimizations...

Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Thursday December 27, 2018 @07:38AM (#18769112)
It can!

LLVM is fantastic, but it's also a huge C++ component, and it's not necessarily optimized for speed. It would be nice to end up with something in Rust to simplify the toolchain needed, and to maybe have something that could be even faster for debug builds.

Re:Rust 2019 and beyond: limits to some growth by cageface on Wednesday December 26, 2018 @08:08PM (#18766351)
Maybe it makes sense to read the success of Golang as a smart piece of social engineering. Start with a simple and accessible language and gradually ratchet up the complexity to deal with more real-world problems. You may eventually wind up with a worse language but at least you'll have users. Rust tried to solve a lot of hard problems out of the gate and that has slowed its growth IMO.

It's sort of another worse-is-better dichotomy.

Re:Rust 2019 and beyond: limits to some growth by jniedrauer on Thursday December 27, 2018 @01:39AM (#18767865)
Go is still a very simple language. It's not just social engineering. Compare it to Python, which is another "simple" language that you can be dangerous in on day one.

As you gain experience in Go, you learn idiomatic ways to do things and memorize the core library, but the fundamental mechanics don't change.

As you gain experience in Python, you develop a preference for virtualenvwrapper and experiment with 300 different ways to build a distributable package, then start extending __getitem__ and __setitem__ and adding decorators to everything and before you realize what you've done, you've torn apart the laws of physics and your code has nightmarish side effects lurking around every corner.

Re:Rust 2019 and beyond: limits to some growth by sevensor on Thursday December 27, 2018 @09:26AM (#18769571)
> As you gain experience in Python, you develop a preference for virtualenvwrapper and experiment with 300 different ways to build a distributable package, then start extending __getitem__ and __setitem__ and adding decorators to everything and before you realize what you've done, you've torn apart the laws of physics and your code has nightmarish side effects lurking around every corner.

Alternatively, you glimpse the chthonic horrors lurking at the end of that path, purge your code of hidden mutable state, and use Python to write straightforward procedural programs.

Re:Rust 2019 and beyond: limits to some growth by shmerl on Wednesday December 26, 2018 @09:07PM (#18766699)
That social engineering strategy only helps in the short term (short on the language scale, which can still be many years). If you get a convoluted language in result, in the long term it will increasingly irritate programmers, who will anyway start looking for objectively better alternatives. So Rust took the right approach IMHO.
Re:Rust 2019 and beyond: limits to some growth by cageface on Wednesday December 26, 2018 @09:11PM (#18766720)
What tends to happen is that you bring out a simplified, cleaned-up version of the popular language of the day. People then flock to that new language and start making feature requests. Over time that language becomes as complex and inelegant as the language it replaced and you can start the whole cycle all over again.

The move from C++ -> Java -> Go is a perfect example of this cycle.

Re:Rust 2019 and beyond: limits to some growth by e3b0c on Thursday December 27, 2018 @12:32AM (#18767584)
C is a language designed to enable more efficient communication between the computer and the programmer in mind.

C++ is a language designed to enable more communication between the compiler and the programmer.

Go is a language designed to enable more efficient communication between programmers.

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @10:28AM (#18769956)
C was a language designed by two developers without background in language design that got lucky, because Bell Labs wasn't allowed to sell UNIX thus it ended up licensing it for a symbolic price to universities.

C was hardly efficient in the 80s micro-computers, and outside Bell Labs people were doing compiler optimization research in languages like PL.8 and similar.

Had Bell Labs been allowed to sell UNIX and history would certainly looked much different.

Re:Rust 2019 and beyond: limits to some growth by e3b0c on Friday December 28, 2018 @03:20AM (#18775501)
When talking about "efficient communication" between the computer and the programmer, it does not necessarily imply the characteristics of the runtime performance.

For instance, Fortran is very performant in numerical computing, even outperforming C, but it has difficulty in accessing I/O mapped registers or implementing an interrupt handler, a jump table, or just cleaning a particular chunk of memory addresses.

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Friday December 28, 2018 @07:34AM (#18776391)
Another urban legend from C yearly days. There was plenty of research in system languages since the early 60's outside Bell Labs, with OSes being written in Algol, Pascal and PL/I variants.

"Oh, it was quite a while ago. I kind of stopped when C came out. That was a big blow. We were making so much good progress on optimizations and transformations. We were getting rid of just one nice problem after another. When C came out, at one of the SIGPLAN compiler conferences, there was a debate between Steve Johnson from Bell Labs, who was supporting C, and one of our people, Bill Harrison, who was working on a project that I had at that time supporting automatic optimization...The nubbin of the debate was Steve's defense of not having to build optimizers anymore because the programmer would take care of it. That it was really a programmer's issue.... Seibel: Do you think C is a reasonable language if they had restricted its use to operating-system kernels? Allen: Oh, yeah. That would have been fine. And, in fact, you need to have something like that, something where experts can really fine-tune without big bottlenecks because those are key problems to solve. By 1960, we had a long list of amazing languages: Lisp, APL, Fortran, COBOL, Algol 60. These are higher-level than C. We have seriously regressed, since C developed. C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. This is one of the reasons compilers are ... basically not taught much anymore in the colleges and universities."

-- Fran Allen interview, Excerpted from: Peter Seibel. Coders at Work: Reflections on the Craft of Programming

Re:Rust 2019 and beyond: limits to some growth by klodolph on Thursday December 27, 2018 @01:31AM (#18767836)
I don’t think Java and Go will ever, combined, reach the complexity of C++.

The reason why older languages are complex and inelegant is because our understanding of how to create simple yet useful languages has increased, not because older languages accumulate much complexity.

Re:Rust 2019 and beyond: limits to some growth by adrianN on Thursday December 27, 2018 @08:33AM (#18769311)
Wanting to do what the new languages can do without breaking backwards compatibility is a big reason why C++ got so complicated. C++98 isn't all that complex, but if you want to learn C++20 you still have to learn every language feature that was developed in the last thirty years and how they all interact.
Re:Rust 2019 and beyond: limits to some growth by klodolph on Thursday December 27, 2018 @07:14PM (#18773837)
I would disagree with the claim that “C++98 isn’t all that complex.” It was so complex that any project I found using it would restrict itself to some arbitrary subset, just to keep complexity under control. Java has gone through years of backwards-compatible changes, and is still wonderfully simple compared to early versions of C++. C++ started with a mess of different features and hasn’t really gotten worse. If anything, C++11 is simpler than C++98 from a user’s perspective, even though it’s not from an implementer’s perspective.

One of the big differences is that Java and Go have straightforward context-free grammars, mostly, and you can whip up a working parser in no time. C++ is a bit of a beast, by comparison (hence keywords like “typename”).

C++ also has the complex overloads and template system. I think people underestimate how complex these things are when they are learning C++, and how complex their interactions are. Then there’s the preprocessor.

You can kind of argue that these are just an accumulation of changes, but other languages contemporary with C and C++ do not suffer from these complexities, so the argument falls flat. By comparison, Go and Java rely on reflection or code generation more, and these are a bit simpler.

Re:Rust 2019 and beyond: limits to some growth by shmerl on Thursday December 27, 2018 @08:49PM (#18774296)
> I think people underestimate how complex these things are when they are learning C++, and how complex their interactions are. Then there’s the preprocessor.

And then there is arcane stuff like this:

* https://en.cppreference.com/w/cpp/language/eval_order

* https://en.cppreference.com/w/cpp/language/copy_elision

That does make the language feel very complex even without the whole templates depth.

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @03:09PM (#18772199)
Just like wanting to learn Python 3.7 means learning about 500 PEPs and how they interact across each Python release (major.minor, during the last 25 years and alternatives to CPython.
Re:Rust 2019 and beyond: limits to some growth by adrianN on Thursday December 27, 2018 @03:28PM (#18772357)
Well Python 3 broke compatibility so you don't have to start at Python 0.1 alpha, but yes, completely understanding Python is also no easy task. I write Python almost every day and have taught courses using it, but I know of features that I don't understand. There are probably more that I'm not even aware of.
Re:Rust 2019 and beyond: limits to some growth by InGodsName on Wednesday December 26, 2018 @11:50PM (#18767399)
There is also a sunk cost fallacy which keeps people trapped.
Re:Rust 2019 and beyond: limits to some growth by mroche on Thursday December 27, 2018 @01:47AM (#18767898)
Sunk cost or costly effort? There are a more than a handful of large of technologies, frameworks and libraries used in my industry which would have to be ported/rewritten and supported from C++ before anyone would think twice before using an alternate language. Particularly when speed is the name of the game (in terms of integration, not just compiled binaries). There are hundreds of C++ libraries employed daily that would be non-trivial to port.
Re:Rust 2019 and beyond: limits to some growth by shmerl on Thursday December 27, 2018 @02:04AM (#18767953)
Things are being rewritten, and those which are still not, can be used by combining languages.
Re:Rust 2019 and beyond: limits to some growth by adrianN on Thursday December 27, 2018 @02:53AM (#18768138)
It's not a fallacy if you either have to manage two language stacks or rewrite huge codebases. Those things are expensive.
Re:Rust 2019 and beyond: limits to some growth by jurip on Thursday December 27, 2018 @04:11AM (#18768436)
This is what Guy Steele's Growing a Language talk was all about: "I should not design a small language, and I should not design a large one. I need to design a language that can grow. I need to plan ways in which it might grow—but I need, too, to leave some choices so that other persons can make those choices at a later time."

https://www.youtube.com/watch?v=_ahvzDzKdB0

or as PDF:

https://www.cs.virginia.edu/~evans/cs655/readings/steele.pdf

Re:Rust 2019 and beyond: limits to some growth by duncanawoods on Thursday December 27, 2018 @04:48AM (#18768577)
It's been a while since I watched this but my current thoughts on "Growing a language" is that I fear it is an unhelpful simplification of what makes language design hard. IMHO language design is a holistic design problem that needs global optimisation. You cannot incrementally hill-climb yourself anywhere useful when you can't backtrack over past decisions.

It is like designing a workshop. You only have so much space within arms reach. Here you place your most frequently used and valuable tools. You can "grow your language" by adding tools but they can't replace what you have in this limited and privileged position - instead, new tools have to go in cupboards or on another table. The new tools will have higher friction than the first priority tools you added.

Maybe you can have a workshop where you imagine a tool and it appears in your hand thereby removing the constraint of "tools within reach" but I think this then makes it too ephemeral and abstract. It is the constraints that makes a language tactile and ergonomic - remove the constraints and you have no structure at all.

In this case, the "tools within reach" are your core keywords and syntax. Growing features via libraries or syntactic extensions generally incur more ceremony and less elegance. Having totally flexible syntax extensions/keywords doesn't solve the problem, it just moves up a level abstraction/generality and means you have given your users the "design a language" problem instead of solving it for them.

Re:Rust 2019 and beyond: limits to some growth by wool_gather on Thursday December 27, 2018 @10:57AM (#18770192)
> you have given your users the "design a language" problem instead of solving it for them

This is an interesting observation that reminds me of

> In Lisp, you don't just write your program down toward the language, you also build the language up toward your program.

from Paul Graham's "Programming Bottom-Up". Some people would consider it an advantage being allowed to fold the "design a language problem" into the overall problem.

More, I think this is just a matter of degree, not kind.

As soon as you have something as apparently simple as named procedures, you're really writing a DSL, albeit very coarsely, for your business problem. Add named record types. Add textual macros. Add operator overloading. Add Lisp-style macros. At every point where the language allows a word on the screen to stand in for something larger, you're giving the programmer the power to design a language for their problem domain.

Re:Rust 2019 and beyond: limits to some growth by nabla9 on Thursday December 27, 2018 @04:44AM (#18768560)
Guy's point was that the language should be designed to be grown grown by users, not by language designers.

> We need to put tools for language growth in the hands of the users.

Guy's previos work with Common Lisp is epitome of this. There are three kind of macros in the language: reader macros, macros and compiler macros. They give the tools for the user to extend the language. There is just 25 or so core primitives in the 'core' language and the runtime. The rest 900+ functions and symbols are basically the standard library (the fact that they are slapped into the same package and they extend the core in a ways that other languages can't hides the simplicity of the language somewhat).

Re:Rust 2019 and beyond: limits to some growth by joppy on Thursday December 27, 2018 @07:56AM (#18769176)
This is an amazing talk, and a transcript does not do it justice in the slightest. If you have the time, listen to the talk!
Re:Rust 2019 and beyond: limits to some growth by cageface on Thursday December 27, 2018 @04:47AM (#18768572)
I think this is a really appealing idea but so far nobody’s managed to build a successful language this way. I’d love to see a mainstream language designed on these principles myself but I think it’s not going to be an s-expression based language.
Re:Rust 2019 and beyond: limits to some growth by ramchip on Thursday December 27, 2018 @06:50AM (#18768944)
Whether it’s mainstream is debatable, but I think Elixir is a really successful example of extensible language, and indeed it managed to do this without s-expressions. Various libraries extend the language for HTTP routing, parsing, DB queries, property testing, static analysis, etc. It makes possible a lot of experimentation by the wider community, and not just the group of core language developers.

The creator has repeated this philosophy a few times:

> There is very little reason for an Elixir v2.0 with breaking changes. The language was designed to be extensible and if we need to do major changes to the language to improve the language itself, then we failed at the foundation.

https://elixirforum.com/t/what-would-you-like-to-see-in-elix...

> A big language does not only fragment the community and makes it harder to learn but it is also harder to maintain. It is also why the language was designed to be extensible: so the community could build what is necessary without a push to make everything part of the language.

https://elixirforum.com/t/questions-about-property-testing-s...

> We also understand there is a limited amount of features we can add to the language before making the journey too long or the language too big. Adding something now means not including something else later. As an exercise, let’s see a counter example of when we didn’t add something to the language: GenStage. [...]

https://elixirforum.com/t/questions-about-property-testing-s...

Re:Rust 2019 and beyond: limits to some growth by oscargrouch on Wednesday December 26, 2018 @11:43PM (#18767376)
I dont think that by looking only to features we can understand this very well. Go was very lucky to be launched when cloud computing fever was catching up, and people were being burned for using techs like Java for this end.

C++ were very performant, and unlike Java not a memory hog, but for this sort of tasks it was deemed to complex. Besides the ammount of people that were able to program in it was limited (and you can even see this reasoning being used as a reason why they created Go).

Then Go showed up with simplicity and a good story in performance and memory, deploying simple binaries in a world of complex server infrastructure paved out by Java was a very handy and right on time approach.

The problem with Rust now, is that it is target the system programming, in a era of system programming renaissance given the whole mobile app scenery.

The problem is; there is already a lot of C++, C, Java, Objective C and Swift code there, so it will be hard to have a good reason to rewrite complex stuff with a lot of man hours in it in Rust.

Every language needs a platform. C is here because of Unix, C++ because of Unix, games and early 2000 and 90's era startups. Java and C# because of bussiness software, Go because of the cloud, Ruby and PHP; because of webservers, Rails an blogs, Python for educational purposes, Data Science, ML and now AI.

Now what about Rust? Its trying to eat some lunch from C and C++. But a lot of code and value is already there in C and C++, where rewriting it in Rust just for some ocasional added value here and there is not reasonable.

Its really tough, and if Rust dont find a platform to grow it will be very hard to advance any further. But, there's always new tech waves and tools that will marry perfectly with them.

Lets see which languages are able to be a perfect fit for them in years to come. But right now Rust will depend a lot of the community it already formed to keep sharp and maybe be lucky to surf one of those waves.

Re:Rust 2019 and beyond: limits to some growth by dan00 on Thursday December 27, 2018 @09:01AM (#18769463)
> Now what about Rust? Its trying to eat some lunch from C and C++. But a lot of code and value is already there in C and C++, where rewriting it in Rust just for some ocasional added value here and there is not reasonable.

For existing software it certainly is less about rewriting it but extending it in Rust.

Thanks to not having a runtime and being quite easy to create a shared library with a C-ABI, pretty much any software written in any language could be extended with code written in Rust.

Re:Rust 2019 and beyond: limits to some growth by oscargrouch on Thursday December 27, 2018 @01:07PM (#18771203)
> Thanks to not having a runtime and being quite easy to create a shared library with a C-ABI, pretty much any software written in any language could be extended with code written in Rust.

Ok, but you kind of added complexity to your codebase. Now you will need not only C++ coders, but also Rust coders. If you are Mozilla or Google you can do that, you eat complexity for breakfast.. But they are probably not the companies you need right now to keep your steady growth, unless of course you are lucky that they created some killer app in Rust because of their in-house use of it. Like Google did recently with Kubernetes, only it is in Go of course, but i guess it checks the square of a killer app which helps into the language adoption as a programming trend.

Speaking of Go, it once was suffering from the same problem Rust is going through right now. It was sucessful in a first phase because of its community, but it needed more to start having more adoption and mind share. Then, Docker happened, and Go found a sweet spot to aim for and take it to the second base.

Re:Rust 2019 and beyond: limits to some growth by 1-KB-OK on Thursday December 27, 2018 @10:14AM (#18769858)
It's a good point that a language needs a platform to really shine. I think one place where Rust can find it is by targeting WASM and being the first systems language that can compile to code that runs in the browser. The rustc compiler supports WASM out of the box and I think this is one direction that the language adoption is going to grow.

Another platform is cryptocurrencies/blockchains- Rust lends itself uniquely as a modern C++ for writing performant blockchain protocols. This is evidenced by the Parity team using Rust exclusively for all their projects. As that world evolves Rust can find a foothold there as well - there is no real legacy code floating around, the Bitcoin protocol is only 10 years old.

Re:Rust 2019 and beyond: limits to some growth by oscargrouch on Thursday December 27, 2018 @01:37PM (#18771409)
These are definitely a couple of good bets to be aiming for.

The blockchain trend reminds me that Rust could also try to find some cosy home in banking software, in expert systems and in embedded software.

The key now is to be humble and not to try to pick up a fight with C and C++ just yet.

Go only now is in a position to pick a fight against Java in the server and in the cloud, and Rust will probably need to get into the same point of adoption, if it wants to be seen as a serious contender to those languages in the eyes of the people they need to convince.

Unfortunatelly Rust missed a good new trend now, with multi-platform cores for mobile phones that ended up being written mostly in C++.

Rust wasnt even invented when people were trying to solve the problem of multi-os phone apps.

And that is the current trend which is giving the system development trend a second chance. But is not that bad, because thats exactly what is making people to take a serious look at Rust.

Battery life, memory, storage. It all matters again thanks to the phone environments, and you cant afford the be wrapped in layers upon layers of software virtualization like it was common in the early PC era, where Java and C# were kings.

Re:Rust 2019 and beyond: limits to some growth by izacus on Wednesday December 26, 2018 @07:59PM (#18766307)
No offense, but that's been the tune we've been constantly hearing for years now. Always the "next big thing" killing off C++ or Java or something with its superiority. And yet, somehow, when choosing a very efficient language that has 1st party support, we always end up with pretty much one widely supported answer: the horror that is C++.

Why do you think that Rust will be a different story this time?

Re:Rust 2019 and beyond: limits to some growth by gameswithgo on Wednesday December 26, 2018 @08:44PM (#18766552)
Most of us aren't concerned with whether anything would kill off C++. That certainly won't happen any time soon, given the inertia. But some of us would like to be able to use a language that lets you do low level, high performing goodness, without having to use C++. So it is nice that there are some more viable options now.
Re:Rust 2019 and beyond: limits to some growth by paulddraper on Wednesday December 26, 2018 @08:08PM (#18766354)
Nothing will "kill off" C++.

Nothing -- not even C++ -- "killed off" C.

But it's share of total usage can and will decrease. Java certainly took a massive chunk of the "programming market" that would have otherwise been C++. And then later JavaScript. Of course, software usage in general has been going up and up, so in absolute terms C++ has been increasing as well.

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @10:36AM (#18770016)
C++ has a hard fight against C on embedded platforms where we still have devs using C89 + Assembly, and on classical UNIX flavours.

It certainly looks much different in other platforms and modern OSes.

Re:Rust 2019 and beyond: limits to some growth by pantalaimon on Wednesday December 26, 2018 @09:21PM (#18766764)
I feel like C is having a renaissance because of that.

C is very conservative in adding new features, which makes it easy to get an understanding of the language - nothing is hidden, when necessary you can derive everything you need to know about a piece of code from first principles.

C compared to C++ feels like high school math compared to university math with all it's scary notations.

Re:Rust 2019 and beyond: limits to some growth by Ar-Curunir on Thursday December 27, 2018 @02:08AM (#18767970)
I don't think this is true: what C leaves out in terms of language features , programmers have to reinvent or keep in their heads perpetually while writing code, leading to tons of gotchas.
Re:Rust 2019 and beyond: limits to some growth by Too on Thursday December 27, 2018 @02:51AM (#18768130)
Yep, to reuse the math analogy. C is like solving 3d geometric problems by manually aggregating endless lines of cos, sin and sqrt, instead of using vector mathematics where you can do the same with just a single line of matrix multiplication or a simple dot-product.
Re:Rust 2019 and beyond: limits to some growth by lifthrasiir on Thursday December 27, 2018 @08:03AM (#18769203)
In the other words, C standard library is not really small. It consists of a small mechanized portion and a much larger portion embedded in wetware, i.e. human mind. The second portion is very hard to update or fix, so the first portion keeps growing to cover all faults of the second.
Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @03:17PM (#18772274)
And POSIX plays the role of an additional runtime library.
Re:Rust 2019 and beyond: limits to some growth by kerkeslager on Wednesday December 26, 2018 @09:47PM (#18766852)
It's not just the notations, either. I'm not a particularly strong C programmer (I don't write it professionally, I write Python) but I've read documentation for the entire C standard library[1], for example.

[1] https://en.wikipedia.org/wiki/C_standard_library

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @10:32AM (#18769985)
Where is that renaissance happening?!?

Certainly not in the C compilers that have been ported to C++, the OSes that now push for C++ instead of C, automative standards that replaced C by C++14 as certified language, IoT platforms based on C++,...

Re:Rust 2019 and beyond: limits to some growth by zanny on Wednesday December 26, 2018 @07:57PM (#18766297)
I don't feel like C was ever meant to be the permanent foundation on which all other computing was built. It was a language for its time. It took assemblies of the 70s made them much more palatable with an imperative syntax. C++ was also not meant to be a permanent foundation. It took shortcomings in C for scale and hacked on top functionality Bjarne wanted.

The complexity difference between a computer 46 years ago, almost half a century, when C was first developed and now is incomprehensible. It is reflected in how these languages, fundamentally, are willing to just say "since the computer only runs in 30 cycles a second and we are just doing increment operations if you break the rules it undefined" and the idea of having behavior native to the grammar that would impose kilobytes of size complexity or megacycles of computation would have been absurd.

At the time, of course. Modern C++ doesn't hesitate to generate multiple vtables for a complex class while juggling reference counting smart pointers with streamlined initialization grammars that can take up thousands of words of memory. But because the primitives that must remain stable for backwards compatiblity were built on the most constrained architectures the whole house of cards is thus constrained.

I think Rust has already made a lot of "just get it out there, don't think about the ramifications" decisions in its language design, especially around its grammar. On one hand there is still logic to what glyphs do what and how control flow is laid out - particularly concerning minimizing the number of retraced parses the source needs to go through - but it doesn't change the syntax of lifetimes ('), the use of double colon namespacing (::), or the turbofish but being an unintitive disgusting hack.

In my experience the RFC process though has helped temper that. All those blemishes are predominantly from the origin of the language up through ~2014. Once the ecosystem developed and decisions required months or years of hanging around on the issue tracker to see stabilization Rust mostly stopped grafting on arcane behavior and started reusing its syntax in intuitive ways (like impl trait).

I don't think any of the current crop of outstanding wants really makes the language more complex. A lot of it is just increasing the compliers complexity to handle more generic code, be it in terms of kindedness or by type delegation or inference. Those kinds of complexities aren't generally something for users to explicitly learn in rote memorization to use the language - if Rust introduced overloading and default arguments all those who don't know it exists won't have the language made any harder to use, but those that want it can take advantage of it.

As long as Rust is never tempted into the "a substantial portion of this behavior is undefined if not done explicitly as intended" hole that C and C++ were predestined to fall upon I don't think features make the language harder. The core syntax is there, shouldn't change, and is being made easier and more intuitive, not harder and more complex (NLLs save the day, and the number of explicit lifetimes needed have been culled dramatically in the last two years of development). In just a few glyphs of C++: void* = 0 - there are already all manner of edge case, undefined behavior, syntactic complexity beyound comprehension.

Nobody working on Rust today wants arcane, impossible to process grammar or undefined behavior complexity. The language already mostly lacks it. Nobody in their right mind will add it. Thats never a feature, its the bug Rust fixes that is inherent to the C lineage in ways nothing but a rewrite can fix. It took a decade of pain for Python to change its string type from bytes to unicode - there is absolutely no way to salvage C or any of its descendants. By design. From its fundamentals. All the complexity on top has just been repeated attempts to temper the fundamental incongruities.

Re:Rust 2019 and beyond: limits to some growth by Thiez on Thursday December 27, 2018 @04:20AM (#18768469)



> if Rust introduced overloading and default arguments all those who don't know it exists won't have the language made any harder to use, but those that want it can take advantage of it.

The following program might no longer compile if `f` could be overloaded, additional type annotations would be required.

    fn f(n: u8) -> u8 {
        n + 5
    }
    let o = Some(Default::default());
    println!("{:?}", o.map(f));
In general I would expect overloading to make type inference less reliable (not so much with the compiler getting it wrong, but needing more annotations), which users of Rust that do not want overloading would be right to object to.
Re:Rust 2019 and beyond: limits to some growth by zanny on Thursday December 27, 2018 @09:36AM (#18769629)
I don't want to really derail the thread into a discussion on overloading - I was citing it more as an example of a common desire that also introduces a lot of compiler level complexity without really modifying the language syntax - but I imagine any first pass conservative overload implementation would be restrictive enough to let the compile know if theres only one definition of a function. Default would only break if there were 2+ impls of the same signature and would just require a type annotation then.

I'd argue you could not implement overloading without enough support being in place to let the current single signature inference work as it does, which is also probably a good chunk of why its never been really proposed in earnest. Its a hard problem to approach.

Re:Rust 2019 and beyond: limits to some growth by pantalaimon on Wednesday December 26, 2018 @09:33PM (#18766800)
I think the fear of unrefined behaviour is starkly exaggerated in everyday C programming. If you follow the established best practices (and the compiler will warn you if you don't) you will not experience undefined behaviour.

> Those kinds of complexities aren't generally something for users to explicitly learn in rote memorization to use the language - if Rust introduced overloading and default arguments all those who don't know it exists won't have the language made any harder to use, but those that want it can take advantage of it.

This however is only true if you never have to work with someone else's codebase, When you start creating dialects your usual 'style' will feel alien in another project or you may have trouble understanding how something works due to an arcane language feature you've never had to use.

Re:Rust 2019 and beyond: limits to some growth by lambda on Wednesday December 26, 2018 @09:45PM (#18766844)
> If you follow the established best practices (and the compiler will warn you if you don't)

There are a lot of best practices that can be quite hard to follow without language support, and would generate too many false positives to warn about. For instance, use after free. There is no lifetime information available in the type system that the C compiler could use to tell you whether you are doing something that could result in a use-after-free. How do you propose the compiler could catch these, except in the most trivial cases?

Re:Rust 2019 and beyond: limits to some growth by pantalaimon on Wednesday December 26, 2018 @09:52PM (#18766870)
Common practice would be to set the pointer to NULL after free and if you have multiple pointers to the same object - well, try to avoid doing that. If you must, you can use reference counting.
Re:Rust 2019 and beyond: limits to some growth by wasted_intel on Wednesday December 26, 2018 @10:12PM (#18766952)
> well, try to avoid doing that

I think that's pretty terrible advice for something that affects memory safety, and it invalidates your entire "the compiler will warn you" argument. There's a reason Rust has ownership and lifetime annotations: there are many things that a compiler simply cannot infer.

Re:Rust 2019 and beyond: limits to some growth by pantalaimon on Wednesday December 26, 2018 @10:26PM (#18767020)
I haven't looked into Rust very much yet, but doesn't the borrow checker effectively prohibit you from having multiple references to the same object?

I wouldn't say it's terrible advice though. If I see that something I do is potentially dangerous and would require special care to get it right, I'd first look if there is another way to do it.

Re:Rust 2019 and beyond: limits to some growth by lambda on Wednesday December 26, 2018 @11:32PM (#18767319)
The borrow checker allows for one mutable reference, or multiple immutable references. There are also primitives for allowing interior mutability through shared references, which enforce single access at a time by other means (mutexes, copying data in and out, etc).

References are always guaranteed to point to something that lives longer than them. What they refer to could either be on the stack, or it can be allocated and deallocated on the heap via smart pointers. Box<T> is similar to C++'s unique_ptr; there is a single owner, and when that owner is dropped, the referenced value is dropped. Arc<T> is similar to C++'s shared_ptr; it's an atomically reference counted pointer, so the value will be deallocated when the last clone is deleted.

These combine in ways that allow you to use most of those "best practice" patterns from C and C++, but with actual language guarantees that you will follow them and the compiler will catch it if you don't. In the internals of data structure implementation, you may need to go beyond what this allows with use of unsafe, but you can limit that just to a few small critical pieces of code that can be more thoroughly audited and tested.

In a large project "try to avoid doing that" doesn't really fly; in a large codebase, with dozens of developers, developed over multiple years, people are going to make mistakes. They will need to do some kind of refactoring, and one of the guarantees will get missed.

If you've done a decent amount of work in a large C or C++ codebase, you might appreciate this description of the process of storing a reference to a slice of a Vec in Rust, without having to manually reason about all of the places in which that slice could be invalidated: https://manishearth.github.io/blog/2015/05/03/where-rust-rea....

This article, written as a way to help introduce Rust 1.0, provides a few more examples, though they are artificial rather than from a real-world project: https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.h...

Re:Rust 2019 and beyond: limits to some growth by wasted_intel on Wednesday December 26, 2018 @10:41PM (#18767094)
For vanilla references (&), Rust will prevent you from having multiple mutable references. Beyond that, there are several types in the stdlib[0] that progressively increase flexibility, but always safely.

I think it's bad advice because you need to know what is potentially dangerous. That alienates newcomers to systems programming (which is why one of Rust's goals is to be able to "hack without fear"). There are also some designs that I'd never try to build without safety checks, because they're notoriously hard to get right. Even knowing the fundamentals of memory safety, without a way of enforcing lifetimes and mutability, writing zero-allocation implementations that share immutably can be daunting.

[0] Cell, RefCell, Mutex, Rc, Arc

Re:Rust 2019 and beyond: limits to some growth by adrianN on Thursday December 27, 2018 @02:59AM (#18768159)
The neverending stream of exploits based on undefined behavior proves you wrong. There is not a single widely used codebase that is completely free of UB and doesn't come with a formal proof.
Re:Rust 2019 and beyond: limits to some growth by shaklee3 on Thursday December 27, 2018 @01:00AM (#18767702)
I agree. I see comments like that time and time again. As someone who writes it professionally, it just doesn't occur as often as the internet would make you think.
Re:Rust 2019 and beyond: limits to some growth by ThenAsNow on Thursday December 27, 2018 @12:50PM (#18771080)
It's not a simple matter of how frequently it occurs, the fundamental question is one of rigor. The principal difference between craftsmanship and engineering is also rigor. Historically, the ability to prove your code was free of classes of error required sacrifices that few practicing software developers could or would accept (e.g., formal proofs, use of "niche" languages, uncomfortable toolchains, etc.).

What's got people excited is the evolution of these systems which have a rich intersection between rigor and usability (to include ecosystem, tooling, etc.). The ability to statically eliminate classes of error with good (or maybe good enough) ergonomics means these questions of "how frequently does this occur" are not relevant - you can drive such occurrences to zero and doing so should become table stakes. This is a proper engineering mindset.

None of this is to dismiss craftsmanship, which definitely has its place. And before the ability to practically apply rigor, that's all there was. After all, people have been building complex systems for centuries without the benefit of modern mathematical foundations. But none of those are good reasons to eschew rigor when it is within reach and when the systems you develop are big/complex/widely-used enough.

Re:Rust 2019 and beyond: limits to some growth by barrkel on Thursday December 27, 2018 @07:59AM (#18769181)
You think this until you're on the front line exposed as attack surface directly or indirectly via linkage. This is a knowledge category where ignorance really does give people unfounded confidence.
Re:Rust 2019 and beyond: limits to some growth by shaklee3 on Thursday December 27, 2018 @11:24AM (#18770418)
What does linkage have to do with anything? Why would statically linking in go be more safe than in C?
Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @03:19PM (#18772293)
The continuous growth of CVE entries shows otherwise.
Re:Rust 2019 and beyond: limits to some growth by aaaaaaaaaab on Wednesday December 26, 2018 @05:59PM (#18765615)
Let’s revisit this when Rust has...

- the number of users

- the amount of mission-critical legacy code that has to compile

- the number of compiler vendors

- age

... comparable to C++’s.

Re:Rust 2019 and beyond: limits to some growth by taneq on Wednesday December 26, 2018 @06:35PM (#18765823)
I'm not sure that's an important comparison. They're not saying that there's no good reason for the current state of C++, or that they can't understand why it's like that. They're just saying that it'd be nice if Rust didn't disintegrate into the same morass of new syntax, primitives, idioms and pitfalls that C++ has become.
Re:Rust 2019 and beyond: limits to some growth by paulsutter on Wednesday December 26, 2018 @07:45PM (#18766239)
According to that we should all be using COBOL

Did you hear they’re finally making it object oriented? The name will be ADD ONE TO COBOL

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Thursday December 27, 2018 @10:36AM (#18770023)
Cobol is already OOP for several years now.
Re:Rust 2019 and beyond: limits to some growth by adwn on Thursday December 27, 2018 @01:24PM (#18771303)
> Cobol is already OOP for several years now.

I think that was supposed to be a joke, mocking Cobol's verboseness (compare "C++", which adds 1 to C and which extends C with OOP).

Re:Rust 2019 and beyond: limits to some growth by reificator on Wednesday December 26, 2018 @06:37PM (#18765833)
Let's also come back to it when Rust is older than C++.

It's a new language targeted toward people who want stability and performance, what do you expect to see by now?

Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @06:41PM (#18765872)
Rust will never be older than C++ since they both get one year older every year ;)
Re:Rust 2019 and beyond: limits to some growth by StavrosK on Wednesday December 26, 2018 @08:12PM (#18766375)
Oh age is just an int, and it'll overflow at some point.
Re:Rust 2019 and beyond: limits to some growth by _ek94 on Thursday December 27, 2018 @06:15AM (#18768847)
Interpreting GP's comment using the Principle of Charity[1], I assume GP meant "older than C++ is now".

[1]: https://en.wikipedia.org/wiki/Principle_of_charity

Re:Rust 2019 and beyond: limits to some growth by reificator on Thursday December 27, 2018 @11:00AM (#18770214)
Or making a joke, which is supposedly verboten here.
Re:Rust 2019 and beyond: limits to some growth by skywhopper on Wednesday December 26, 2018 @07:20PM (#18766122)
No, the point is to get ahead of C++'s situation so as not to repeat its mistakes. You can't do that if you wait until it's too late.
Re:Rust 2019 and beyond: limits to some growth by paulddraper on Wednesday December 26, 2018 @06:07PM (#18765661)
> ... comparable to C++’s.

When? 2018? 1990?

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Wednesday December 26, 2018 @06:13PM (#18765696)
In the 1990's we already had a couple of OS vendors shipping C++ compilers on their OS SDKs (Apple, IBM, Microsoft, Be, Symbian).

So far that is only true of Redox.

Re:Rust 2019 and beyond: limits to some growth by noir_lord on Wednesday December 26, 2018 @06:19PM (#18765726)
To be fair though 1990's C++ written in the recommended way is almost a completely different language to 2018 C++.

The change isn't as marked as say perl5 and perl6 but it is still huge.

I've no dog in either fight though, I moved to managed languages a long time ago (Object Pascal was the last compiled language I used in anger).

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Wednesday December 26, 2018 @06:22PM (#18765753)
True, but many of the "modern C++" stuff like RAII, type safe strings, arrays, collections were already possible in C++ compilers for MS-DOS for example, it was a matter of actually using them.

Not sure which managed languages you mean, those that I use also provide the option to compile to native code just like Object Pascal, if I wish to do so.

Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @06:20PM (#18765741)
And Fuchsia.
Re:Rust 2019 and beyond: limits to some growth by lostmsu on Wednesday December 26, 2018 @07:08PM (#18766045)
There's an official Rust support in SDK? There's an official SDK?
Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @07:11PM (#18766064)
I’m talking about FIDL, to be clear: https://fuchsia.googlesource.com/docs/+/d4f9b980f18fc6722b06...

(And I also elaborate more about specifics in my other sibling comment)

Re:Rust 2019 and beyond: limits to some growth by pjmlp on Wednesday December 26, 2018 @06:24PM (#18765760)
Fuchsia is still largely written in C++, with a couple of modules like the TCP/IP stack, written in Go, and Dart for the UI layer.

To what extent is Rust being adopted by the Fuchsia team?

Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @06:28PM (#18765780)
There’s a few hundred thousand lines of Rust in Fuchsia. (Garnet’s repo claims 12% Rust as of today.) They’ve been hiring Rust programmers aggressively to add more. They’ve been helping drive the design and implementation of async/await, since they’re big users. Rust is one of the four or five languages that they maintain a sort-of-libc for and use it as an example for writing applications for the OS. (It’s a microkernel, so it’s not really a libc so much as it is their IPC layer, which is how you make the equivalent of syscalls in other languages. “FIDL”)
Re:Rust 2019 and beyond: limits to some growth by pjmlp on Wednesday December 26, 2018 @06:35PM (#18765825)
I see, so is that an indication that Zircon might eventually migrate to Rust?
Re:Rust 2019 and beyond: limits to some growth by steveklabnik on Wednesday December 26, 2018 @06:44PM (#18765904)
I don’t think there’s any plans to move Zircon. It’s also less pressing, IMHO, since it is a microkernel. Maybe someday, but if I were in charge, it wouldn’t be super high in my list.
Re:Rust 2019 and beyond: limits to some growth by firethief on Wednesday December 26, 2018 @06:47PM (#18765916)
So, when it's too late?