Live data from Hacker News

Cling: Running C++ in an interpreter

blog.coldflake.com

1–10 of 49 posts

Re: Cling: Running C++ in an interpreter

#5

So, what are it's limitations, if any?

I'd say error recovery could be better. You often get kicked out of the session and than your environment is lost. Also: they claim the 'auto' keyword is implicit, does not seem to work for me. But it's pretty cool to use!

Re: Cling: Running C++ in an interpreter

#8

Well, for anyone interested in Cling, check out this Google tech talk: http://www.youtube.com/watch?v=f9Xfh8pv3Fs This is a CERN project and it uses Clang from the LLVM project. The idea is simple: use the clang to generate LLVM and then use LLVM just-in-time compiler.

Before that CINT was used (another C++ interpretter) - here is the page where they announce the future transition CINT -> CLING - http://root.cern.ch/drupal/content/cling

Re: Cling: Running C++ in an interpreter

#9
Could you not just use a project directory template? All you need really is a .c(xx|pp|whatever) file, a Makefile, and then the workflow for a new idea is:

cd ~/src;

cp -R c-idea-template foobar;

cd foobar;

$EDITOR test.c*

and in your editor (say vim) just run :make

or write a .sh file with all of the above in it so it's just one step. No complex install procedure, you get all your normal tools and stuff.

Alternaitvely, create a 'test projects' git(hub) project, with the files you want in it, and create a new branch for each idea. That way you get backups as well.

Re: Cling: Running C++ in an interpreter

#10
post #7

Why would I do that :S

Why not? It's great to quickly test C++, I have yet to find a developer who doesn't love a REPL for one. C++ could also be used as an embedded extension language using something like this.

I share your enthusiasm but there are limits. C++ compilation speed (and thus interpretation speed) will make it quite impossible to use it as an extension language. And while I like and use C++ a lot I don't think it is the right language for this purpose. It can do quite a lot of things, but working in a homogeneous language in your extensions as well as your core product doesn't have enough benefits compared to using a systems programming language and an extension language.
Post reply on HN