News for hackers. Stuff that matters.
Re:Carbon: high level programming language that compiles to ... by michaelfeathers on Saturday October 20, 2012 @08:31AM (#4676913)
It's odd to see compilation to C as a main selling point.
Re:Carbon: high level programming language that compiles to ... by tomjen3 on Saturday October 20, 2012 @10:17AM (#4677110)
Not really. There is a C compiler for every platform worth its salt.
Re:Carbon: high level programming language that compiles to ... by michaelfeathers on Sunday October 21, 2012 @08:10AM (#4679527)
My point was that usually a language does more to sell itself. The selling point of C++ wasn't "here's a language that compiles to C" (which it was in the beginning), but rather "Here's a safer, OO version of C with many new features."
Re:Carbon: high level programming language that compiles to ... by alexchamberlain on Saturday October 20, 2012 @08:48AM (#4676944)
Some of us rather like C...
Re:Carbon: high level programming language that compiles to ... by cbsmith on Saturday October 20, 2012 @02:18PM (#4677770)
Yeah, which is why traditionally a LOT of languages, particularly early in their careers, have compiled down to C. Really aside from JVM targeted languages, it still tends to be the trend.

So it is pretty weird for that to be highlighted as the big distinctive feature.

Re:Carbon: high level programming language that compiles to ... by rat87 on Saturday October 20, 2012 @06:21PM (#4678347)
> Yeah, which is why traditionally a LOT of languages, particularly early in their careers, have compiled down to C. Really aside from JVM targeted languages, it still tends to be the trend.

What about .net/mono targeted languages, javasvcript targeted languages? And custom interpreters jit(frequently but not always written in c)

Re:Carbon: high level programming language that compiles to ... by cbsmith on Friday November 02, 2012 @01:32AM (#4731381)
CLR targeted languages are few and far between, as are JavaScript targeted languages, so I didn't consider them a big enough factor to impact the "trend".

People focused on entirely new languages tend not to target JITs first for the same reason they tend to not target direct machine code first: it just adds complexity to getting a proof of concept out the door. LLVM, the JVM, and yes, the CLR are starting to change this, but aside from the JVM, there are still only a handful of languages going that route.

Re:Carbon: high level programming language that compiles to ... by cpeterso on Saturday October 20, 2012 @03:07PM (#4677926)
LLVM has C backend, though it is not fully supported. It seems like it would.be helpful for bootstrapping LLVM for a new architecture and for A/B testing of other backends' performance and correctness.
Re:Carbon: high level programming language that compiles to ... by mistercow on Saturday October 20, 2012 @10:55AM (#4677196)
Sure, but that doesn't make it a good intermediate representation for a programming language. I really like CoffeeScript, but compiling to it would be insanity.

That said, there are some good reasons for compiling to C. Not every architecture has a backend for LLVM yet, after all.

Re:Carbon: high level programming language that compiles to ... by slurgfest on Saturday October 20, 2012 @01:26PM (#4677609)
Some would say "I really like JavaScript, but compiling to it would be insanity." And yet CoffeeScript is there. How is that better than a language which compiles to C?
Re:Carbon: high level programming language that compiles to ... by mistercow on Saturday October 20, 2012 @05:46PM (#4678297)
If you read the second part of my comment, you'll see that I agree that there is a legitimate reason to compile to C. It turns out to be identical to the legitimate reason for compiling to JS - some platforms can't be targeted directly, so you make do with the options you have.

I was not disputing the conclusion that it can make sense to compile to C. I was just saying that "people like C" doesn't support that conclusion.

Re:Carbon: high level programming language that compiles to ... by alexchamberlain on Saturday October 20, 2012 @03:01PM (#4677902)
Unfortunately, there is a massive reason to compile to JavaScript... browsers.
Re:Carbon: high level programming language that compiles to ... by eternalban on Saturday October 20, 2012 @09:32AM (#4677022)
C is eternal. Have you tried Go?
Re:Carbon: high level programming language that compiles to ... by alexchamberlain on Saturday October 20, 2012 @09:39AM (#4677034)
I have not... Should I?
Re:Carbon: high level programming language that compiles to ... by eternalban on Saturday October 20, 2012 @11:15AM (#4677250)
Check out the std lib: http://golang.org/src/pkg/ -- that's canonical Go code.

It's my language of choice for personal projects. A neat and compact language that is very trivial to pick up, feels light, and yet sufficiently subtle to intellectually engage your mind.

Very productive, good performance, and very portable.

http://www.youtube.com/watch?v=HxaD_trXwRE

caveat: /imho/ the runtime is not yet fully cooked. ETA is Go1.1 (end of year I believe) for beefed up internals.

Re:Carbon: high level programming language that compiles to ... by jrajav on Saturday October 20, 2012 @09:26AM (#4677013)
Well, it automatically implies a pretty high baseline of performance and (if it's done right) unmatched portability.
Re:Carbon: high level programming language that compiles to ... by Someone on Saturday October 20, 2012 @03:16PM (#4677963)
"it automatically implies a pretty high baseline of performance"

I doubt that. It may be (mostly) true for languages that match the capabilities of C well, but if a language does not match C well, it certainly isn't 'automatically' because the optimizer in your C compiler will not help much in making the implementations of such features efficient.

For example, compiling JavaScript to C, it would be non-trivial to make the result as fast as the current JavaScript engines because the C code would likely have to do the same zillions 'is this a string?' checks that interpreters do (probably even more of them because it is harder to see the wood for the trees in your translated-to-C code)

For example, it would require lots of work to support, for example, Lisp's number system, Dylan's union types, any variant of 'eval', or, to take an extreme example, to map Intercal code sequences to efficient C operations such as '+'.