News for hackers. Stuff that matters.
Re:Why C++ Is Not "Back" by beatgammit on Sunday December 02, 2012 @12:53AM (#4860266)
I completely agree. I wish the author had mentioned one of the other replacements for C++, like D, Go or, as you mentioned, Rust.

C++ can't be fixed by adding to it. That's how it got so unmanageable in the first place. Personally, I just write in C when I need performance, but then again, I don't work on large projects that need raw speed.

For me, D and Go are good enough. They beat the pants of any interpreted language, and they offer compelling features not found in C++ (like simplicity, have you seen D's templates? Work of art...).

Re:Why C++ Is Not "Back" by tikhonj on Sunday December 02, 2012 @01:24AM (#4860340)
I don't think Go is any more appropriate as a comparison to C++ than Java or C# are. After all, Go essentially competes in the same space as Java and C#--it's a managed imperative language designed for use on a server.

Now, D and Rust are another story. After doing a bit of reading, I'm actually very excited about Rust. For me, Go is essentially completely useless: it fills the same niche as Java, C# or--far more importantly--Haskell or OCaml. If I need code that's relatively fast but don't want to sacrifice memory safety or the convenience of a high-level language, I can do much better than Go.

On the other hand, if I want really low-level access to the system, for whatever reason, I don't have many good choices. I could do C, but that's rather unsafe and unpleasant; I could do C++, but it's a gigantic, overly complex language and also rather unsafe and unpleasant and I could do D. (I've actually heard good things about D but have never tried it.)

Rust gives me the perfect alternative--a simpler, higher-level language that's more pleasant to use but still lets me operate at a relatively low level. So next time I need to do something like that (which, honestly, probably won't be soon), I'm almost definitely going to use Rust, even if it's in active development and changing all the time.

EDIT: In re-reading this comment, I have realized that "high-level" and "low-level" really aren't great terms (at least the way I'm using them). Particularly, they're not mutually exclusive: a language can both support a high level of abstraction and provide low-level systems access where needed. Of course, I can't think of any language that actually does this, but Rust seems very promising.

Re:Why C++ Is Not "Back" by acqq on Sunday December 02, 2012 @01:48AM (#4860392)
If you're doing anything serious, you need something that is going to compile even when compiler changes from version to version, unless you plan to write only a few lines, when it doesn't matter which language is used anyway. That's why I don't understand your argument for Rust.

I'd vote for D.

Re:Why C++ Is Not "Back" by pcwalton on Sunday December 02, 2012 @03:25AM (#4860555)
Rust feature freeze is soon. These days we reject probably 90% of the proposals to incompatibly change the language.

There will still be churn, but it's much smaller nowadays; once we hit 1.0 we will be committing to backwards compatibility.

Re:Why C++ Is Not "Back" by Dn_Ab on Sunday December 02, 2012 @04:32AM (#4860689)
I'm also really excited about Rust. What would be unimaginable exciting would be if Rust has any plans for iPhone or Android devices. Preferably without a 10MB runtime and a decent debug story. Elsewise, absent the runtime,F# is the most interesting language closest to fitting that bill.
Re:Why C++ Is Not "Back" by pcwalton on Sunday December 02, 2012 @07:32PM (#4863302)
Rust definitely has Android support planned.
Re:Why C++ Is Not "Back" by eliasmacpherson on Sunday December 02, 2012 @04:11AM (#4860653)
If you look at what's been added and removed from C++ and the C++ STL as of C++11, there are changes required to get formerly valid code to compile under it too. noexcept() as a replacement for throw() in particular. I'm sure Rust has a lot more frequent changes though.
Re:Why C++ Is Not "Back" by hamstergene on Sunday December 02, 2012 @05:53AM (#4860828)
Rust is changing because it's still under development. D had that period too.
Re:Why C++ Is Not "Back" by shawn-butler on Sunday December 02, 2012 @06:23AM (#4860890)
I gave up on D despite all the positives some time ago because of no support for ARM by Digital Mars. I wonder if the situation is improved now with the GDC effort to use GCC 4.7, 4.8 as a backend?
Re:Why C++ Is Not "Back" by pjmlp on Sunday December 02, 2012 @04:15PM (#4862529)
You have support via GDC and LDC.
Re:Why C++ Is Not "Back" by shmerl on Sunday December 02, 2012 @01:57AM (#4860406)
Rust got into more stable state with the last release.
Re:Why C++ Is Not "Back" by pretoriusB on Sunday December 02, 2012 @06:48AM (#4860922)
>If you're doing anything serious, you need something that is going to compile even when compiler changes from version to version, unless you plan to write only a few lines, when it doesn't matter which language is used anyway. That's why I don't understand your argument for Rust.

C changed going to ANSI C, and C++ change a lot from "C with classes" to the first standard. And D, the one you would "vote for"? Wasn't there the whole mess between 2 versions of the language and libraries?

So, why should Rust be any different, considering it's still in design and pre-stable?

When the spec freezes and Rust hits version 1, it would be a fully suitable language for his needs.

Re:Why C++ Is Not "Back" by 4ad on Sunday December 02, 2012 @09:41AM (#4861306)
Go is not a managed language, it's compiled to machine code and it gives access to the memory layout, just like C and C++ and unlike Java or C#.
Re:Why C++ Is Not "Back" by pjmlp on Sunday December 02, 2012 @04:22PM (#4862568)
Take care with Go PR, and don't mistake languages with implementations.

Java compilers to native code:

- VMKit

- gcj

- Excelsior JET

C# compilers to native code:

- Windows Phone 8 deployment

- NGEN

- Bartok

- Mono with -aot

Additionally C# has control over memory layout via pointers, aligment attributes, marshaling, structs and generics.

Re:Why C++ Is Not "Back" by 4ad on Tuesday December 04, 2012 @06:35AM (#4870405)
tikhonj was talking about implementations when he described Go as managed imperative language. Go is compiled to native code in all major implementations. In general, it's extremely easy to determine when people are talking about implementations and when they are talking about the language proper. Implementations are important. The primary implementation shapes the language, the way the standard library is designed and scoped, and seeds the ecosystem surrounding the language. Changing the implementation to a native one after the fact changes very little.

> Additionally C# has control over memory layout via pointers, aligment attributes, marshaling, structs and generics.

This is not true. The level of control you get is extremely limited due to the fact that very few types are values in C#.

Re:Why C++ Is Not "Back" by pjmlp on Tuesday December 04, 2012 @08:54AM (#4870877)
> Go is compiled to native code in all major implementations

So is C#, bytecodes are only used as a storage format.

With Microsoft tooling you can JIT at load time, NGEN at installation time, convert to MDIL when uploading to Windows 8 App Store, or convert to pure binary with Bartok in Singularity.

With Mono tooling you can JIT at load time or generate binaries with mono -aot.

With Cosmos OS , it gets compiled to native code.

> This is not true. The level of control you get is extremely limited due to the fact that very few types are values in C#.

Please provide an example where Go compilers offer more control than C# ones.

Re:Why C++ Is Not "Back" by 4ad on Wednesday December 05, 2012 @07:11PM (#4879465)

  type T struct {
  	X, Y P
  	J *Q
  	Z [42]struct {
  		A R
  		W [100]S
  	}
  }
Please note that P, Q, R and S are arbitrary types, not just a subset of value types, and an instance of T is contiguous in memory.
Re:Why C++ Is Not "Back" by pjmlp on Thursday December 06, 2012 @03:26AM (#4880860)
Ah ok, now I understand your point and you're right.

I was actually under the impression that any value type could be used in fixed buffers.

You can however workaround that by using fixed byte buffers with serialization, but it is not so programmer friendly.

Re:Why C++ Is Not "Back" by dysoco on Sunday December 02, 2012 @08:17AM (#4861097)
I think of Go as a "modern replacement for C", being designed by Rob Pike and Ken Thompson: I think it's really designed to be a Systems Programming language, I wouldn't write a Kernel or a Driver in Go: but it's a modern alternative to implement other related software like userland or networking.

I also like Rust, but I'll wait until it's more stable and we have a couple of books to learn from.

Re:Why C++ Is Not "Back" by eriksank on Sunday December 02, 2012 @06:56AM (#4860939)
It seems quite easy to use C libraries from Rust but not the other way around.

Since you cannot easily use Rust libraries from C -- where is the .h header file generator? -- you cannot easily use it from any scripting engine either. How would its language constructs carry across on the C ABI anyway?

So, Rust also accidentally becomes a final, top-level language, competing in that space with Javascript, Python, Ruby, PHP, Perl, Lua and so on.

Rust does not stand a shadow of a chance in that space. Therefore, it can only suffer a fate worse than C++, which in spite of all problems can still be accessed from scripting engines.

Re:Why C++ Is Not "Back" by kibwen on Monday December 03, 2012 @03:51PM (#4867715)
This is mistaken, there are mid-term plans to make Rust code able to run standalone--without a runtime and with a C-compatible ABI--such that it will be entirely possible to call Rust from C.