News for hackers. Stuff that matters.
Re:Parsing C++ is literally undecidable (2013) by rienbdj on Friday October 04, 2019 @02:04AM (#21155204)
Can we design a language (cpp-prime?) that is basically c++ but makes parsing easier? I'm thinking reduce the keyword reuse, use different symbols for multiplication and pointers etc. The code would be easy for c++ developers to read and converting between the two could be automatic. However, we would be able to build tooling for this new language much more easily. It would also compile quicker.
Re:Parsing C++ is literally undecidable (2013) by cmrdporcupine on Friday October 04, 2019 @07:20AM (#21156544)
Oh, you haven't read this classic paper?

http://users.monash.edu/~damian/papers/PDF/ModestProposal.pd...

"We describe an alternative syntactic binding for C++. This new binding includes a completely redesigned declaration/definition syntaxfor types, functions and objects, a simplified template syntax, and changes to several problematic operators and control structures. Theresulting syntax is LALR(1) parsable and provides better consistency in the specification of similar constructs, better syntacticdifferentiation of dissimilar constructs, and greater overall readability of code."

Re:Parsing C++ is literally undecidable (2013) by etalian on Friday October 04, 2019 @08:01AM (#21156708)
I wondered the same a while ago, and it turns out you can, in fact to test this hypothesis I ended up implementing such a language myself. The resulting syntax can express every construct from modern C++, is fully LALR(1) (no ambiguities and no vexing parses), has fewer keywords and is in general shorter than the equivalent C++ code, and once you know the syntax it is (subjectively) easier to read too (no spiral rule for example). Plus of course it can fully interoperate with existing C++.

Have been waiting to make it open source until I have finished writing the user manual (aiming for the end of this year), if that's interesting to you I post updates about it on twitter at cigmalang.

Re:Parsing C++ is literally undecidable (2013) by zamadatix on Friday October 04, 2019 @09:51AM (#21157660)
Do you have any examples of the syntax?
Re:Parsing C++ is literally undecidable (2013) by skocznymroczny on Friday October 04, 2019 @02:09AM (#21155227)
In theory that's D. D was designed to be easier to parse than C++, for example, it uses Foo!Bar and Foo!(Bar, 4) template syntax rather than Foo<Bar> and Foo<Bar, 4>. On the other hand, it still uses templates and supports mixins (basically #define on steroids), so while it's easy to parse, large chunks of code don't exist until compile time so can't be indexed by IDEs perfectly.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @02:57AM (#21155430)
And as much as I like their community, I feel it already lost its spotlight opportunity, due to their lack of manpower vs other languages offerings and continuous improvements.

Even if C++ is a little baroque, C++17 and now C++20 provide many of the D's benefits, while keeping all the libraries, and finally we are getting Java like C++'s tooling to just throw it away.

Re:Parsing C++ is literally undecidable (2013) by otabdeveloper4 on Friday October 04, 2019 @03:29AM (#21155567)
> due to their lack of manpower vs other languages offerings and continuous improvements

No. D failed due to a mandatory GC and the 'two standard libraries' idiocy.

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @03:52AM (#21155669)
Plenty of GC enabled system languages have proven their value, up to building full stack graphical workstations, so far they just lacked somg big corp political and monetary willingness to push them down the anti-GC devs no matter what.

Thanfully with the likes of Swift on iDevices, Java/Kotlin on Android (with an increasingly constrained NDK), COM/UWP über alles + .NET on Windows, ChromeOS + gVisor, Unreal + GCed C++, those devs will have a very tiny niche to contend with.

I give it about 10 years time, for pure manual memory management to be like Assembly and embedded development.

Re:Parsing C++ is literally undecidable (2013) by jstimpfle on Friday October 04, 2019 @04:33AM (#21155864)
> I give it about 10 years time, for pure manual memory management to be like Assembly and embedded development.

For someone who has spent some time thinking about memory management strategies, manual MM isn't actually that much additional work. By far, most code doesn't allocate or free (and that's a good thing). So MM->GC is hardly like Assembly->Compiler. In Assembly you're constantly allocating and pigeonholing, and you can't have nice names for things. Assembly->Compiler is a huge step compared to MM->GC, and GC can cause a lot of headaches as well. (disclaimer, I've done almost no assembly at all).

Re:Parsing C++ is literally undecidable (2013) by eru on Friday October 04, 2019 @05:19AM (#21156051)
> By far, most code doesn't allocate or free (and that's a good thing).

Depends on the code you write. If, like in C++, non-stack memory management is painful, programmers tend to react like you suggest.

In pure-by-default languages, you are creating new and destroying old objects all the time. (At least conceptually. A sufficiently smart compiler can eliminate most of that.)

Re:Parsing C++ is literally undecidable (2013) by MauranKilom on Friday October 04, 2019 @01:51PM (#21160138)
Obviously depends on the use case, but since C++11 there is little to no pain involved in manual non-stack memory management. You clearly express the ownership semantics through things like std::unique_ptr and std::shared_ptr and if those make sense then everything works (minus problems like circular shared_ptr references, which exists in similar forms with GCs).
Re:Parsing C++ is literally undecidable (2013) by eru on Saturday October 05, 2019 @08:57AM (#21165242)
> (minus problems like circular shared_ptr references, which exists in similar forms with GCs)

Most GC can deal with circular references just fine?

Re:Parsing C++ is literally undecidable (2013) by MauranKilom on Saturday October 05, 2019 @06:52PM (#21168510)
Yeah, I didn't elaborate this enough (because it wasn't really the main point). When I said "similar" I meant "things holding onto things they should no longer be holding onto", not circular referencing in particular.

I realize that the kind of bug that leads to effective memory leaks with GCs has its own equivalent in manual memory management, but my overall point was that neither manual memory management nor GCs make you immune to leaks from badly designed or incorrectly implemented data structures. Each takes some aspect(s) of pain away.

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @04:58AM (#21155962)
On single developer projects as long as one doesn't stay too much away from them, scale it up to multiple sized distributed teams, add binary libraries, and you end up with double frees, leaks and ownership issues all over the place.
Re:Parsing C++ is literally undecidable (2013) by jstimpfle on Friday October 04, 2019 @09:58AM (#21157736)
Of course there will always be some issues somewhere. But, ignoring perfect memory safety, the issues are widely overblown, to the extent that I find manually managing memory a lot easier than dealing with GC once a project grows beyond a couple KLOC.

It's all about proper planning and code organization. Use pooling, central manager structures, etc. If it can be avoided, then do not allocate and free stuff in a single function like you would carelessly do with automated GC. Structure the data such that you don't have to release stuff individually - put it in containers (such as vectors or maps), such that you can release everything at once at certain points in time, or such that you can quickly figure out what can be released at central code locations (that's much like automated GC, but it's staying in control and retaining room for optimization).

I don't think "multiple distributed teams" makes the challenge any harder. You certainly want to (and I'm sure you easily can) contain each ownership management domain wholly in one team.

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @11:48AM (#21158818)
> You certainly want to (and I'm sure you easily can) contain each ownership management domain wholly in one team.

That doesn't work in enterprise projects with heavy dosis of consulting.

Re:Parsing C++ is literally undecidable (2013) by gpderetta on Friday October 04, 2019 @05:16AM (#21156041)
Purely anecdotally, I spend very little of my time thinking about what passes for manual memory management in C++.

For me the big attraction of GC is memory safety not convenience.

Re:Parsing C++ is literally undecidable (2013) by bitwize on Friday October 04, 2019 @08:06AM (#21156742)
Try Rust. Proven memory safety, no GC.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @08:14AM (#21156803)
Until one tries to do GUI programming, then it is Rc<RefCell<>> everywhere, or arrays with vector clocks for managing old entries.
Re:Parsing C++ is literally undecidable (2013) by gpderetta on Friday October 04, 2019 @08:12AM (#21156788)
no opportunity at $CURRENT_JOB, but in the future, sure, it is definitely on my radar!
Re:Parsing C++ is literally undecidable (2013) by bitwize on Friday October 04, 2019 @08:04AM (#21156732)
Building a GC into your system means building nondeterministic amounts of latency into it. Those "full stack graphical workstations" were notorious for being slow, expensive, and coming to a dead halt whenever the heap filled up.

Thankfully, we have RAII as in C++ and Rust and ARC in Swift, which give you automatic memory management without a tracing GC.

If your language requires a GC, it is a complete failure as a systems programming language.

Re:Parsing C++ is literally undecidable (2013) by ChrisLomont on Friday October 04, 2019 @08:46AM (#21157061)
>Building a GC into your system means building nondeterministic amounts of latency into it

That's not true. You can pool, you can call GC when needed, you can build incremental GC with bounded times, and so on.

Check stackoverflow - there's plenty of links to papers and real-world examples of fixed-time garbage collectors. Or check google scholar and read papers.

Go has demonstrated a very efficient garbage collector.

Here [1] is one from Oracle for Java.

>If your language requires a GC, it is a complete failure as a systems programming language.

Plenty of OSes are in development and/or researched using managed languages and GC. Singularity [2] is but one example. I suspect in the future that doing memory management by hand will be as obsolete as writing an OS in assembly. The benefits for security, robustness, and productivity will outweigh the costs, just like the benefits for using higher languages to develop in, while slower than hand-tuned assembly, far outweigh the costs.

[1] https://www.oracle.com/a/ocom/docs/oracle-jrockit-real-time-...

[2] https://en.wikipedia.org/wiki/Singularity_(operating_system)

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @08:10AM (#21156778)
Interestingly I never saw that phenomen on ETHZ graphical Workstations powered by AOS.

And apparently no one noticed that a part of Bing used Midori for a while.

That is alrigth, according to Midori team, Windows team also did not accept what Midori was capable of, even when proven wrong.

Having a GC is non different than malloc spending all its time doing context switches to reclaim more OS memory, using the actual OS memory management APIs.

It is up to the developers to decided to use a GC based allocation, stack, global memory segment or plain untraced heap allocations.

The tools are there, naturally there is a learning process that many seem unwilling to do.

And by the way, Swift's reference counting implementation gets wiped out by tracing GCs on the ixy paper.

Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @08:56AM (#21157142)
Well, GC latencies don't bother game developers who work with Unity or people using Java or C# for high speed trading.

Realistically, having the option to use a GC is a boon for many applications. Not everything is hard realtime all the time. Some complex applications tend to have a hard realtime part and parts where it doesn't matter. E.g. a CNC machine controller does not need a guaranteed response time for the HMI or G code parser. But it needs to have a tight control loop for the tool movement.

D is a language where the GC is default, but optional. And the compiler can give you a guarantee that code that explicitly opts out does not interact with the GC and -importantly - can't trigger a GC run that way. However, as this was an afterthought, parts of the language need to be disabled when opting out and not a lot of library functionality works with that.

Re:Parsing C++ is literally undecidable (2013) by bluGill on Friday October 04, 2019 @09:12AM (#21157268)
GC latencies doesn't bother them, because they put large efforts into ensuring there is not garbage to collect. Tricks normally reserved for hard real time embedded systems like allocating all memory buffers at startup time.

GC is very useful for programs that don't have any form of real time - but games are real time and thus you need to be careful to ensure that the worst case of the garbage collector doesn't harm you. Reference counted garbage collection gives you this easier than the other means. Note that I said worst case - the average case of garbage collection is better in most garbage collected languages.

Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @09:55AM (#21157700)
I have never seen such memory mamagement tricks employed in Unity scripts. I'm not saying that they don't exist. They are only rarely required. To be honest, I expected things to be much worse from previous experiences.
Re:Parsing C++ is literally undecidable (2013) by bluGill on Friday October 04, 2019 @10:16AM (#21157917)
There are of course a large number of it depends. Sometimes there isn't a problem sometimes there is.
Re:Parsing C++ is literally undecidable (2013) by thesz on Tuesday October 08, 2019 @08:44AM (#21191611)
Using trees of resources is building nondeterministic amount of latency into your system.

One of my first (after awhile) forays into C++ was to analyze big WFST graph to find various statistics. And I found that my program spent as much time freeing resources as doing actual work. Subjectively, of course, yet.

I knew it can happen, so it was not big surprise.

Re:Parsing C++ is literally undecidable (2013) by otabdeveloper4 on Monday October 07, 2019 @03:15AM (#21178261)
> I give it about 10 years time, for pure manual memory management to be like Assembly and embedded development.

Yeah, I've heard that 25 years ago. It was, in fact, the big marketing bullet point on Java's first release.

Meanwhile here in 2019, with the death of Moore's Law, careful memory (and cache!) management is more important than before.

Re:Parsing C++ is literally undecidable (2013) by jacobush on Friday October 04, 2019 @05:16AM (#21156037)
Plenty did but none took a chunk out the C++ world that thrives on manual memory mgmt.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @07:02AM (#21156485)
The C++ world that thrives on manual memory management is usually "C compiled with C++ compilers".

The rest of the C++ world has long moved into automatic memory management as best practices.

Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @09:01AM (#21157184)
I don't think that your statement about C with C++ compilers holds true anymore. I have seen quite a few codebases that are definitely C++, but use bespoke memory management strategies where required. Pool allocators and allocation-only heaps are high on the list of things that are useful in this area, for various reasons.
Re:Parsing C++ is literally undecidable (2013) by bluGill on Friday October 04, 2019 @09:15AM (#21157291)
I'd call most of that C with classes.
Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @09:59AM (#21157747)
As ooposed to what? This is the core of C++, even though feature creep has opened up the language to other coding styles and patterns.
Re:Parsing C++ is literally undecidable (2013) by jacobush on Friday October 04, 2019 @09:03AM (#21157198)
I should have said "not garbage collection" instead of manual memory management.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @04:18PM (#21161523)
Reference counting, regardless how it is implemented (language primitives or library), is a garbage collection algorithm.
Re:Parsing C++ is literally undecidable (2013) by jacobush on Monday October 07, 2019 @01:15AM (#21177730)
This is stretching definitions imho. Ref counting does not stop the world or kick in when you don’t expect it to.
Re:Parsing C++ is literally undecidable (2013) by biggestdecision on Friday October 04, 2019 @10:33AM (#21158090)
Swift's GC is really a lot closer to modern C++ style memory management than the other languages you mentioned. If you use RAII & shared_ptr in C++ you are using the exact same techniques that Swift's "GC" uses.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @11:53AM (#21158861)
And as proven by the ixy paper, quite slow versus tracing GCs.
Re:Parsing C++ is literally undecidable (2013) by biggestdecision on Friday October 04, 2019 @11:52PM (#21163701)
I assume this is what you are talking about? https://www.net.in.tum.de/fileadmin/bibtex/publications/pape...

>A total of 76% of the CPU time is spent incrementing and decrementing reference counters.

ouch

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Saturday October 05, 2019 @02:11AM (#21164077)
Yep, that one.
Re:Parsing C++ is literally undecidable (2013) by im3w1l on Friday October 04, 2019 @02:20PM (#21160385)
Maybe. But shared_ptr should only be used very sparingly. Almost all objects should be stack or unique_ptr.
Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @06:24AM (#21156304)
The GC is realistically only an issue in rare fringe cases. Early on, the competing standard libraries were a massive problem, though. This was overcome with D2, which is already more than a decade old.

When this standard library competition existed, the library ecosystem had this very weird split where half of the libraries you would have liked to use in your project used the other library you couldn't link to at the same time. This prevented me from picking up and trying D for a long time because I didn't want to deal with that. Now that this is over with and a ton of useful libraries exist, I'm glad that I started to use D because this is now a language in which I'm very productive.

Re:Parsing C++ is literally undecidable (2013) by otabdeveloper4 on Monday October 07, 2019 @03:21AM (#21178287)
> The GC is realistically only an issue in rare fringe cases.

Yes, and one of those fringe cases is when you're building a competitor for C++.

Knowing your target audience helps if you're trying to take over the world.

Re:Parsing C++ is literally undecidable (2013) by atilaneves on Friday October 04, 2019 @09:56AM (#21157717)
I went back to C++14 a few years ago after writing D and it was painful. The only addition to C++17 that made my life easier was `void_t`, but even then it's not even close.

Having to deal with headers again and C++'s templates was torture.

Did C++ close the gap? Yes. However, I can still write D 2-3x faster than I can write C++. It's similar to how I'm 2-3x more productive in C++ than in C.

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @05:49PM (#21162199)
I only use C++ alongside Java and .NET, when they need an extra help.

The problem with D in its current state is that its tooling isn't match for OS SDKs + IDE + libraries, beyond the typical POSIX daemon scenarios, unless one is willing to put some effort into it.

So it is hard to catch up to C++, specially after all major compilers reach C++20 compliance.

Re:Parsing C++ is literally undecidable (2013) by rienbdj on Friday October 04, 2019 @04:46AM (#21155917)
Not quite, because D brings many other things. I mean something that is equivalent to C++, with all of the same semantics, but a less ambiguous grammar.
Re:Parsing C++ is literally undecidable (2013) by bluGill on Friday October 04, 2019 @10:15AM (#21157910)
There are been hundreds of attempts using a number of different ideas. The reason for C++ and not those alternatives is there is a lot of C++ code. If most of my code is C++ I don't gain anything from your new language as I spend most of my time maintaining old code. Even if I use your language for new code that means I constantly have to remember if I'm fixing a bug using C++ code rules or the new language rules. Some projects have successfully done this and eventually re-wrote everything. However others have not and the pain of a new language is a problem.

The other problems with that approach means C++ is everywhere.

I know that I can find a good compiler for C++ when I want to switch platforms. Will your new language support my new platform? Will your new language even exist? I've worked on a number of projects where the code was written in some language where the compiler vendor is out of business. This risk works against all new languages (some have overcome it, some have not).

With C++ I know if I need to hire more people I can hire experts to help out. If I choose your language do I have to pay my new employees to learn the language for the first few months? Learning my code (which is always hard no matter what the language) is already going to be a problem using something that nobody knows just makes it worse.

Will your language optimize well? C++ being everywhere means that compilers vendors have put a lot of effort into writing good optimizers. When performance matters C++ will often come in first because of this effort.

Re:Parsing C++ is literally undecidable (2013) by _bxg1 on Friday October 04, 2019 @02:38PM (#21160568)
In other words it's the same network effects that weigh down any attempt at creating a new ecosystem. So if you're going to do that, you may as well start from scratch and do things better from the get-go.
Re:Parsing C++ is literally undecidable (2013) by guenthert on Friday October 04, 2019 @01:40PM (#21160001)
I read the suggestion as being about a new syntax for the existing language C++. For that you'd need 'only' a transpiler (and syntax high-lighter in your favorite support tools), quite possibly written in a readily available language, perhaps even C++. That should address your concerns regarding availability on various platforms and optimization. Your other concerns of course stand.

I, for one, find different languages with similar appearance needlessly confusing. I what the experience with different syntaxes for the same language would be.

Re:Parsing C++ is literally undecidable (2013) by gpderetta on Friday October 04, 2019 @05:14AM (#21156029)
You could, but the incompatibility is not necessarily worth it.

There was some talk to take advantage of the transition to modules to be able to mark translation units as implementing a specific version of the standard (I think rust doese something similar) to allow for backward incompatibile Evolution of the language.

The committee doesn't seem to keen because they fear the language fragmenting and from a more practical point of views we will be still #including legacy code into new modules for at leas a decade (and I'm probably wildly optimistic).

Re:Parsing C++ is literally undecidable (2013) by gmueckl on Friday October 04, 2019 @06:13AM (#21156257)
With the glacial pace in which new language features are picked up by users of C++, I'd be surprised if modules have significant adoption in the first decade after C++20. It'll probably take at least two to three years to get stable support in most of the tooling and then anther couple of years until people start to believe that they are battle tested enough.
Re:Parsing C++ is literally undecidable (2013) by xiphias2 on Friday October 04, 2019 @03:56AM (#21155692)
Rust seems to be the most successful zero-overhead language competitor to C++, though it's far not as mature as C++ yet.
Re:Parsing C++ is literally undecidable (2013) by jokoon on Friday October 04, 2019 @04:52AM (#21155937)
Rust has a high learning curve (borrowing, etc). Rust is a competitor to ADA, not C++. You can certainly ask developers to write things in rust instead, and even progressively rewrite codebase in rust since it's compatible with C++, but a language is about adopters, and ease of learning for beginners and students.
Re:Parsing C++ is literally undecidable (2013) by thesuperbigfrog on Friday October 04, 2019 @10:06AM (#21157816)
Rust and Ada are are only incidentally competitors:

Ada was designed for programming safety-critical, military-grade embedded systems.

Rust was designed as a memory-safe, concurrency-safe programming language, largely to overcome the shortcomings of C++.

Each excels at what it was designed for, but the intended use cases are very different.

Rust is not (currently) being used for aircraft flight control systems--Ada is.

Ada is not (currently) being used for high-performance web browsers and servers--Rust is.

While there are SOME similar design goals in terms of memory safety, concurrency safety, and error prevention, Rust was not designed to compete with Ada.

Re:Parsing C++ is literally undecidable (2013) by V_Terranova_Jr on Friday October 04, 2019 @09:03PM (#21163164)
Ada has been on the way out, at least in recent U.S. DoD flight system developments (and likely NASA as well) for a long time. I don't see this trend reverting any time soon.

On the other hand, we can, and I hope will, move to much more rigorous approaches, such as the use of Rust, for flight software implementations. As you say, Rust was not specifically designed to compete with Ada, but accomplishes a number of similar goals and ultimately strives for correctness-by-construction, as does Ada.

We will be better off in flight software using newer, safer languages employed by the software community writ large instead of trying to mandate niche languages.

Re:Parsing C++ is literally undecidable (2013) by thesuperbigfrog on Friday October 04, 2019 @11:25PM (#21163636)
>> Ada has been on the way out, at least in recent U.S. DoD flight system developments (and likely NASA as well) for a long time. I don't see this trend reverting any time soon.

Yeah, C++ has been working out great on the F-35.

>> On the other hand, we can, and I hope will, move to much more rigorous approaches, such as the use of Rust, for flight software implementations.

Competition is good and more choices for building avionics systems are welcome. I don't know of any DO-178C certified Rust implementations, but we need them.

>> We will be better off in flight software using newer, safer languages employed by the software community writ large instead of trying to mandate niche languages.

Part of the issue is that high-integrity, hard real-time embedded systems are their own niche in terms of requirements. Java and C# are widely-used programming languages with hundreds of millions of lines of code deployed in business-critical production environments and yet both are unsuitable for avionics environments. The more avionics niche-specific a programming language becomes the more likely it is to add complexity and features that those who program outside the niche will never use or care about.

Re:Parsing C++ is literally undecidable (2013) by V_Terranova_Jr on Saturday October 05, 2019 @01:24AM (#21163974)
>> Yeah, C++ has been working out great on the F-35.

The number of scary C and C++ architectures flying currently is quite troubling.

While DoD is coming to grips with the fact most aerospace primes take a 1990s approach to software development, other than mostly in research pockets, DoD is still not recognizing the impact of language choice. The late 90s push to embrace COTS threw a lot of baby out with the bathwater.

>> Competition is good and more choices for building avionics systems are welcome. I don't know of any DO-178C certified Rust implementations, but we need them.

One of the impediments to improvement actually is certification. Certification uses a lot of labor and paperwork-intensive proxies for code quality and configuration control that should be revisited in light of modern methods that can assure correctness-by-construction. I'm also not sure any major aerospace prime will generate demand pull for a certified Rust implementation without it being mandated in some fashion by a government regulator or customer (which I personally would not be opposed to).

>> Part of the issue is that high-integrity, hard real-time embedded systems are their own niche in terms of requirements. Java and C# are widely-used programming languages with hundreds of millions of lines of code deployed in business-critical production environments and yet both are unsuitable for avionics environments

Once running atop an RTOS of sufficient quality, what niche language features do you think would be required for avionics, given the widespread use of C and C++ there already? I can understand not wanting to run on garbage-collected runtimes like Java and C#, but once memory management has the determinism of something like Rust, what other functionality do you think is missing?

Re:Parsing C++ is literally undecidable (2013) by carlmr on Friday October 04, 2019 @05:18AM (#21156047)
Counterpoint, when you write C++ you need to think about borrowing without the compiler telling you when you're making a mistake. Rust in that sense is easier than C++.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Saturday October 05, 2019 @03:34AM (#21164258)
Only if you are not using a recent version of clang or VC++.

CppCon 2019: “Lifetime analysis for everyone”

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

It is available to play on Godbolt.

Re:Parsing C++ is literally undecidable (2013) by xiphias2 on Friday October 04, 2019 @03:05PM (#21160852)
I wanted to understand why Ada is not used in systems programming if it's so great, and found the answer:

,,Ada developers either use a garbage collector, or they avoid freeing memory entirely and design the whole application as a finite state machine (both of which are possible in Rust, too, but the point is you don’t have to).

Of course, Ada has range-checked arithmetic, which Rust doesn’t have (it needs const generics first before that can be done in a library), so if you’re more worried about arithmetic errors than dangling pointers, then you might prefer Ada.''

For me not freeing memory sounds like a joke. It's the opposite of zero cost abstraction. Regarding GC there are lots of great languages already (for example modern Java).

Re:Parsing C++ is literally undecidable (2013) by perl4ever on Sunday October 06, 2019 @12:48AM (#21169875)
I didn't remember Ada having a garbage collector...

https://stackoverflow.com/questions/1691059/why-doesnt-ada-h...

Re:Parsing C++ is literally undecidable (2013) by danbolt on Friday October 04, 2019 @01:52PM (#21160149)
Interesting. I feel like most C++ programmers I meet have a high level of enthusiasm for Rust, as it has C++'s high/low level blend and the safety helps prevent more footguns.
Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @08:16AM (#21156823)
To compete with Ada, Rust needs to offer something like SPARK, binary libraries, Ada like IDEs, real time specification, and most important certified compilers.
Re:Parsing C++ is literally undecidable (2013) by unrealhoang on Friday October 04, 2019 @09:39AM (#21157524)
Counterpoint, Rust is actually easier to learn, and take way less time from inception to writing production-ready code.
Re:Parsing C++ is literally undecidable (2013) by jokoon on Friday October 04, 2019 @11:00AM (#21158349)
even the tutorial says that borrowing has a high learning curve
Re:Parsing C++ is literally undecidable (2013) by xiphias2 on Friday October 04, 2019 @11:44AM (#21158779)
The biggest problem with C++ is that all real life production code is full of memory safety bugs. People usually just live with it. If you want to minimize memory safety issues, C++ becomes even harder than Rust.
Re:Parsing C++ is literally undecidable (2013) by jokoon on Friday October 04, 2019 @05:43PM (#21162152)
STL containers usually makes things easier.

Usually the libraries deal with low level issues and are doing the hard work of increasing safety.

Safety will always has a cost somewhere.

Re:Parsing C++ is literally undecidable (2013) by fanf2 on Friday October 04, 2019 @05:22AM (#21156063)
Damian Conway has a couple of papers from 1996 suggesting a better syntax for C++ http://users.monash.edu/~damian/papers/#Human_Factors_in_Pro...
Re:Parsing C++ is literally undecidable (2013) by oblio on Friday October 04, 2019 @10:53AM (#21158293)
You know your proposal failed when there's people born back then that have just finished college this year and they still won't be able to use the changes you proposed ;-)
Re:Parsing C++ is literally undecidable (2013) by alexhutcheson on Friday October 04, 2019 @11:13AM (#21158468)
There's not really a need anymore, because LibClang[1] has solved the parsing problem. Historically it was really hard to write tooling (syntax highlighters, static analyzers, scripts to update build dependendencies, etc.) for C++ due to the difficulty of parsing the language. In the past several years, that has completely changed - you just call LibClang to handle the parsing for you, and work with the high-level abstractions provided by LibClang instead of munging the text yourself. There are lots of reasons to want to replace C++, but "it's hard to write a parser" is no longer a relevant one.

[1] https://clang.llvm.org/docs/Tooling.html

Re:Parsing C++ is literally undecidable (2013) by MauranKilom on Friday October 04, 2019 @01:56PM (#21160185)
You indeed no longer have to do the parsing, but I've been told that even the AST is a beast because the language is so complicated. Corner cases abound. (Note: Have not used libclang myself, but I look at clang ASTs on godbolt from time to time).
Re:Parsing C++ is literally undecidable (2013) by mamcx on Friday October 04, 2019 @10:32AM (#21158085)
> Can we design a language (cpp-prime?)

I dislike, a lot, the C family of languages. I wish that the pascal or oCalm have "won". But being practical, we are stuck in this reality, so:

Is not "we". Is "them". I think only IF the core developers of that languages provide the "blessed" syntax it could actually catch up.

What I have wondered is why C/C++/JS not provide a "clean up" forward policy.

I think all involved are smart enough to see what is wrong with that langs (we always know what suck of what we build with time). Then say:

"This is $IDEAL-C we will targeting. This will fix this list of problems, and maybe this other list, BUT...

$IDEAL-C is a in-progress. Each change is iterative, and will deprecate in steps.

$BAD-C will be continued to be develop. $IDEAL-C transpile to $BAD-C. $IDEAL-C is another file extension. It will keep the same $IDEALS of $BAD-C.

Eventually, $IDEAL-C-STEP-1 will replace $BAD-C and become $BAD-C. And that until we reach $IDEAL-C! "

I know this look like what modern c/c++/js is doing, but the trouble is that that are additive changes. That mean triple work: Keep with $new, still have the problems of $old and maintain $both stuff at the time. What is lacking is doing subtractive changes and REMOVE what is wrong.

The key is transpiling, and not change the core tenants of the lang (ie: C stay as a razor edge).

The big problem, probably, is to not do drastic paradigm changes (ie: turn C in a functional lang), instead, clean the lang until is like what a good, idiomatic, modern developer of it will use.

I think is doable to make $IDEAL-C/C++/JS to be near identical to most developers and from a distance, not look different at all. Being progressive and in steps, provide auto-tranforming tools along the way and I think the community will move on.

I have see, partially, the idea applied with C#, so I think is doable?

P.D: Probably $IDEAL-C must only fix a very small list of stuff, initially. For example, lets say "Remove dangling IFs from C. END"

That its. This small-scope is I think, the key to make the experiment worthwhile.

Re:Parsing C++ is literally undecidable (2013) by pjmlp on Friday October 04, 2019 @02:52AM (#21155419)
It is called Ada.
Re:Parsing C++ is literally undecidable (2013) by choeger on Friday October 04, 2019 @03:34AM (#21155590)
Take an upvote!
Re:Parsing C++ is literally undecidable (2013) by _bxg1 on Friday October 04, 2019 @02:37PM (#21160551)
C--
Re:Parsing C++ is literally undecidable (2013) by saagarjha on Friday October 04, 2019 @02:05AM (#21155211)
C?
Re:Parsing C++ is literally undecidable (2013) by jstimpfle on Friday October 04, 2019 @04:34AM (#21155870)
C has its own parsing problems.
Re:Parsing C++ is literally undecidable (2013) by eru on Friday October 04, 2019 @05:19AM (#21156054)
Yes, though I don't think it's undecidable to parse.
Re:Parsing C++ is literally undecidable (2013) by BubRoss on Friday October 04, 2019 @09:14AM (#21157285)
I say it all the time here, but there was a cool language called clay which was a great redesign of C with modern C++ techniques. It is not kept up anymore. It has an elegant design that, while not perfect, has a lot to offer.

http://claylabs.com/clay/