News for hackers. Stuff that matters.
Re:Toward a TypeScript for C++" by x-shadowban on Saturday November 04, 2023 @10:44AM (#38141455)
C++ only needs 4 things: gradually-introducable memory safety, static reflection, first-class compile time string manipulation, and adoption+refinement of its modules feature.
Re:Toward a TypeScript for C++" by pjmlp on Saturday November 04, 2023 @11:14AM (#38141783)
That is the idea of C++ profiles, based on Ada's language profiles, being pushed by Bjarne Stroustoup.

Now, how willing WG21 and the compiler vendors are open to the idea, is anyone's guess.

Re:Toward a TypeScript for C++" by papichulo2023 on Saturday November 04, 2023 @10:50AM (#38141527)
I'd add less verbose ranges. Idk about memory safety, optional and expected are working pretty well for me (i just use it on personal projects though)
Re:Toward a TypeScript for C++" by uxp8u61q on Saturday November 04, 2023 @12:19PM (#38142456)
You can't possibly put syntactic sugar on the same level as memory safety.
Re:Toward a TypeScript for C++" by zerr on Saturday November 04, 2023 @10:51AM (#38141530)
I'd also vote for std::string split and join functions. And networking.
Re:Toward a TypeScript for C++" by LeSaucy on Saturday November 04, 2023 @12:46PM (#38142707)
Qt?
Re:Toward a TypeScript for C++" by jb1991 on Saturday November 04, 2023 @10:46AM (#38141493)
Lol “only”
Re:Toward a TypeScript for C++" by harrid on Saturday November 04, 2023 @10:58AM (#38141612)
C++ is a memory safe language if not abused.
Re:Toward a TypeScript for C++" by uxp8u61q on Saturday November 04, 2023 @12:30PM (#38142561)
Just don't write bugs!
Re:Toward a TypeScript for C++" by harrid on Saturday November 04, 2023 @12:42PM (#38142661)
It's impossible to memory leak even with bugs if you don't use antique parts of the language that won't pass any static analysis anyways.
Re:Toward a TypeScript for C++" by jiripospisil on Saturday November 04, 2023 @01:06PM (#38142932)
Considering that Chromium, being one of the most heavily statically analyzed code bases, is full of commits which fix memory leaks, your comment makes absolutely no sense.

https://github.com/search?q=repo%3Achromium%2Fchromium+memor...

Re:Toward a TypeScript for C++" by otabdeveloper4 on Saturday November 04, 2023 @01:40PM (#38143319)
Anything written by Google is absolute bottom of the barrel shit.

It's not indicative of anything average in the real world.

Re:Toward a TypeScript for C++" by deschutes on Saturday November 04, 2023 @01:25PM (#38143167)
Chromium is a massive project spanning decades of intense active development that intricately connects just about every domain of programming.

A few leaks fixed per month is nothing. Further there is no major language promising no leaks once you include things like retained references to garbage and reference cycles. Leaks are one thing modern C++ solves pretty well.

Re:Toward a TypeScript for C++" by harrid on Saturday November 04, 2023 @01:48PM (#38143413)
It's a bit hard to get an overview. But I did spot several uses of owning raw pointers and switching from those to managed ones. I'd say that's exactly the point I was trying to make.
Re:Toward a TypeScript for C++" by uxp8u61q on Saturday November 04, 2023 @12:45PM (#38142697)
What antique part of the language am I using in this bugged code?

    class A {};
    std::unique_ptr<A> array(new A[256]);
It's very easy to produce innocuous-looking code that contains leaks. (And yes, I know that make_unique solves the problem here.)
Re:Toward a TypeScript for C++" by harrid on Saturday November 04, 2023 @01:05PM (#38142925)
new
Re:Toward a TypeScript for C++" by leptons on Saturday November 04, 2023 @12:54PM (#38142805)
At this point I'd rather just write assembly language.