
Morph C++ into Javascript - vjeux
http://blog.vjeux.com/2011/javascript/jspp-morph-cpp-into-javascript.html
======
hebejebelus
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. ;)

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

~~~
vjeux
Just added a part on Closure: [http://blog.vjeux.com/2011/javascript/jspp-
morph-cpp-into-ja...](http://blog.vjeux.com/2011/javascript/jspp-morph-cpp-
into-javascript.html#closure)

It was a bit more difficult than expected :(

~~~
iam
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.

~~~
vjeux
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.

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

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

------
kirbysayshi
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?

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

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

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

------
maxogden
not to be confused with <https://github.com/mikeal/jspp>

------
dhruvbird
wow!! this is great!!

------
jpr
I would categorize this as programmer-gore.

