redfloatplane 15 years ago

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 15 years ago

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

  • vjeux 15 years ago

    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 :(

    • iam 15 years ago

      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 15 years ago

        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 15 years ago

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

UncleOxidant 15 years ago

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

kirbysayshi 15 years ago

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 15 years ago

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

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

tomn 15 years ago

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

dhruvbird 15 years ago

wow!! this is great!!

jpr 15 years ago

I would categorize this as programmer-gore.