Hacker News new | past | comments | ask | show | jobs | submit login
Morph C++ into Javascript (vjeux.com)
71 points by vjeux on April 24, 2011 | hide | past | favorite | 13 comments



That's fantastic! I might finally be idly productive in C++ as I am in javascript.

In javascript, I find that you can just write code, while in C++ I feel that I need to plan out every design choice, need to protect against everything. While that's a good thing when writing production code, in certain situations (writing up proof-of-concept projects for example) it's just not what I want. I love that in javascript, half the time I don't need to give a crap - it just works.

Hopefully, as a side-effect of this project, I'll be able to do what I do in C++ as I do in Javascript - although in the long run that probably isn't a good thing. ;)


I don't see closures. That's one of the most powerful aspects of Javascript.


Just added a part on Closure: http://blog.vjeux.com/2011/javascript/jspp-morph-cpp-into-ja...

It was a bit more difficult than expected :(


Good luck, last time I tried nested lambdas in VC10 they weren't able to capture local variables from any context except the immediate outer context.

This makes doing something like e.g. map(map(...)) extremely annoying.

Javascript (nor does, really, any other proper closure implementation) has no such issues.


I started developing with Visual Studio but their C++0x implementation is far from complete.

Indeed, the following easy code ( http://pastebin.com/bjFWBrJq ) does not compile under Visual Studio: "function returning function is not allowed"

It works fine in g++ though.


If C++0x is much closer to javascript CoffeScript to C++ is possible.


I'd rather be able to go the other way. js->c++. But that would be much harder, I think.


There was mention of a performance overhead of _ as a suggestion as to how to improve... How does JSPP, in its current state, compare with V8 execution speed?


Why haven't I seen this blog before? Loads of interesting stuff....

I'll definitely be trying this out. Utterly awesome idea.


Now all we need is a gratuitous regular expression to get rid of the extra bits of syntax...


not to be confused with https://github.com/mikeal/jspp


wow!! this is great!!


I would categorize this as programmer-gore.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: