If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Duetto Clang C++ For The HTML5 Web Is Now In Beta

10-02-2013, 05:20 PM

Phoronix: Duetto Clang C++ For The HTML5 Web Is Now In Beta

Several months ago I wrote about the Duetto C++ compiler that is based upon LLVM's Clang and looks to take C++ programming to the HTML5 web. We hadn't heard anything out of the project since then, but today they're announcing their first public beta...

What the Duetto developers claim differentiates them from EmScripten is that it's "a C++ compiler with a C++ mindset." Duetto compiles standard C++11 code to JavaScript and can handle HTML5 features like WebGL without any middle layer.

Seeing that C++11 from LLVM/Clang is already merging for WebKit2 and making LLVM the compiler defacto for Apple's WebKit 2 I find this all a waste of work.

Comment

Agreed. Outputting HTML5 and creating a web browser are two very different tasks, and I still don't understand why Apple's use of LLVM matters much to that.

But I don't understand the point of Duetto either. I used GWT to compile Java to Javascript for a project a few months back, and ended wondering why I didn't just learn and use Javascript in the first place. C++ makes even less sense; after compiling to Javascript it won't be any faster, it's harder to use, and I'm not aware of any C++ libraries for writing web apps.

Comment

Agreed. Outputting HTML5 and creating a web browser are two very different tasks, and I still don't understand why Apple's use of LLVM matters much to that.

But I don't understand the point of Duetto either. I used GWT to compile Java to Javascript for a project a few months back, and ended wondering why I didn't just learn and use Javascript in the first place. C++ makes even less sense; after compiling to Javascript it won't be any faster, it's harder to use, and I'm not aware of any C++ libraries for writing web apps.

I read up on Enscripten, and it translates OGL calls to WebGL and translates SDL calls to HTML canvas calls. I imagine Duetto will do something similar.

As for why bother using a C++-to-JS compiler, games are the only application I can think of, and I think it makes sense to head in that direction.

Pro's:
* No installation required for playing web games
* Downloading updates just require you to hit F5
* You can still compile natively to platforms that require it

Con's:
* Massive performance loss compared to native
* Compiling to JS, and the browser interpreting the JS adds one more layer of complexity, increasing the chance of something going wrong

Comment

Okay, lets take c++ which was designed to be compiled directly to machine code and compile it to javascript, which is high level interpreted (now actually JIT compiled) language. Then let browser to execute it. This is not the way things should be made. Just add some form of low level language (like LLVM IR) to HTML standard and compile everything to it. This would be faster and simpler.