7 ms·
Cling: An Interactive C++ interpreter
- jokoon 10y agoThat must have been pretty hard to build.
- deleted 10y ago[deleted]
- dguest 10y agoIt was a replacement for the old C++ interpreter, CINT, which was already a central part of a lot of CERN code. Building Cling was probably easier than maintaining CINT.
- jokoon 10y agoStill, since C++ is a statically compiled language by design, doesn't that make it difficult to make it run as an interpreted language ?
- dguest 10y agoSure, and no one is saying it was a good idea in the first place. CINT was notoriously bad as a C++ interpreter, in fact it was marketed as being able to parse 90% of valid C++ code. Imagine someone selling a compiler that way? But CERN developed a huge amount of CINT code anyway, and all of CERNs legacy sort-of C++ code that ran on CINT became a maintenance nightmare. Cling is a huge upgrade in the sense that it supports all this legacy code with a _lot_ less overhead than before.
- kensai 10y ago"Cling is capable to parse everything that Clang can do. In addition, Cling can parse some interpreter-specific C++ extensions." Punchline!
- Bromskloss 10y agoKling och Klang!
- wojciem 10y agoI guess this will finally allow to build full-fledged IDE for C++
- stephengillie 10y agoIt allows for the same "IDE" that works great for me with Powershell - a console window on one side, and N++ on the other side of the screen. N++ Autosave plugin is invaluably rapid here, letting you write some code, then just click/tab to the console and test the module.
- stevedonovan 10y agoEclipse CDT has gotten pretty good in the last few years. Its code scanner is practically a full C++ front-end, and if I pay attention to the red ink I practically never break my builds. That being said, _instant_ C++ is a fantastic thing
- optforfon 10y agoLast time I tried Eclipse (2-3 months ago) it wasn't usable on high DPI screens. Have they fixed tat?
- pjmlp 10y agoLike Lucid Energize C++ in 1993 ? https://www.youtube.com/watch?v=pQQTScuApWk https://www.youtube.com/watch?v=pQQTScuApWk Or C++ Builder or C Set++ for OS/2 (might have the name wrong). If it wasn't for tool vendors having switched their focus from C++ to Java and .NET, until LLVM and clang got created showing everyone what was wrong with their approaches, C++ IDEs might have been much more advanced already, in spite of technical issues with language.
- golergka 10y agoApart from all the awesomeness, it'll be so great to troll people who take language holywars seriously with this.
- userbinator 10y agoYou mean those who claim C or C++ are always compiled and not interpreted? This has been around for a long time: https://root.cern.ch/cint https://root.cern.ch/cint
- rjsw 10y agoThere was also the Sabre C interpreter, early releases of X11 and X10R4 came with the scripts to run it, it didn't do C++ though.
- Create 10y agotruth be told, Masaharu Goto wrote the CINT C++ interpreter at HP Japan and cern/root just embraced it and rolled it into its own floss distribution (F.R. was also an HP-CERN liaison for a very long time). http://www.hanno.jp/gotom/Cint.html http://www.hanno.jp/gotom/Cint.html (Saber-C, the Saber company has become Centerline, and the software itself has been renamed to CodeCenter. saber, xsaber, and sabertool have become codecenter, xcodecenter, and codetool. DEC offered Saber-C on ULTRIX. It never appeared to do very well in the marketplace, which is some kind of tragedy. It was, and is, a terrific piece of software. The fact that a product as useful as Saber-C could fail to do well in the market is an indicator of the impoverishment of software "engineering" practices industry-wide. Anyway, it ended up being ObjectCenter from Integrated Computer Solutions doing C++ and having an IDE with class browsing, with xobjectcenter)
- emmelaich 10y ago@Create you are confusing. Did Saber-C end up being codecenter or xobjectcenter? Is the company Centerline or Integrated Computer Solutions. Who is F.R.?
- trendnet 10y agoWasn't some of that available in LLDB for a year or two?
- wrp 10y agoWindows is unfortunately not yet supported and so far it doesn't look like they are even thinking about it. A few people have managed to build on Windows, but with considerable difficulty.
- CyberDildonics 10y agoDoes this work with windows? I'm still not clear where Clang stands.
- ausjke 10y agoTried to build it and git is asking for username/password git clone https://root.cern.ch/git/root.git src Username for 'https://root.cern.ch': Password for 'https://root.cern.ch': fatal: Authentication failed for 'https://root.cern.ch/git/root.git/'
- indatawetrust 10y agohttps://root.cern.ch/download/cling/ https://root.cern.ch/download/cling/
- amadio 10y agoThere's a GitHub mirror of it here: https://github.com/root-mirror/root https://github.com/root-mirror/root
- indatawetrust 10y agofor download : https://root.cern.ch/download/cling/ https://root.cern.ch/download/cling/
- radarsat1 10y agoI want to see something like this available from gdb. Following code that uses shared_ptr in gdb is still awful. It would be great to be able to explore the stack frame properly, looking at STL containers without hassle and calling functions and everything.
- stevedonovan 10y agoModern gdb does have Python plug-ins, and e.g. I'll get "std::vector of length 3, capacity 4 = {10, 20, 30}" when printing a vector, and "std::shared_ptr (count 1, weak 0) 0x8059e10" when printing a shared ptr. But oh yes, it could be so much better. For instance, often you cannot call methods on template stuff (that is, everything) because 'it may be inlined'
- microcolonel 10y ago"May" ought to be translated as "must". Templated C++ is incredibly sluggish without inlining. People are comfortable debugging C programs with more advanced optimizations turned off because performance will still be decent. In C++, the optimizations are the only reason it ever performs reasonably.
- ccurtsinger 10y agoNot really. Calling a C++ template-generated function is no different than calling a C function. If you have a lot of tiny template-generated functions then sure, it would be slow. But no slower than a C program with a bunch of tiny functions.
- doomrobo 10y agoMaybe they are thinking of specializing for static dispatch?
- pvnick 10y agoCan somebody please shine some light on why such an endeavor was undertaken by CERN? What was so important about JIT C++ that they had to write such a sophisticated piece of software?
- detaro 10y agoIf you look at the root of the domain (https://root.cern.ch/ https://root.cern.ch/) it seems to be part of work on a scientific computing framework in C++. And having a nice REPL is important for this kind of thing, and if it is in C++ you can look deeper into it? (instead of using one of the bindings to Python/... for the REPL, where you can't inspect what is going on inside the C++ code)
- pjmlp 10y agoInteractive programming is very developer friendly workflow, something that was already possible at Xerox PARC in their Smalltalk, Interlisp-D and Mesa/CEDAR environments. Actually there was an early attempt to provide C++ repls back in the early 90's with Lucid Energize C++, after they pivoted from Lisp Machines and applied their knowledge to C++. https://www.youtube.com/watch?v=pQQTScuApWk https://www.youtube.com/watch?v=pQQTScuApWk Also the majority of CERN code is written in a mix of Fortran and C++, and not all teams like to use Python. So they rather use something that provides interactivity to research their algorithms and speed at the same time.
- pvnick 10y agoWow, that's interesting. Interactive python a la jupyter notebook revolutionized my workflow; I guess it makes sense to allow the same for a codebase written largely in c++
- pjmlp 10y agoPython notebooks rediscovered the past and it is quite good that they did so. Now imagine if that was the standard way everyone worked by now.
- hellofunk 10y ago
- optforfon 10y agoCool, but I'm having trouble imagining how I'd use it in my workflow.. Is there a demo or something? I've only used interpreters in MATLAB/R where you have to write one-liners to massage data into the format you need - which seems pretty orthogonal to the way you work in C++
- a3n 10y agoI use the python shell in two ways: to try/explore things in isolation, without having to muck with the larger thing I'm working on; and similarly, just learning things in general without a focus on a particular project. And now with the ipython notebook (jupyter) I use the shell in a third way, to repeatably explore and demonstrate larger, less isolated things that are still sort of one-offs. That said, I think the fact that there is a significant handful of C++ compiler/implementations in use, and some latitude in behavior for each, means that a C++ user is very much a user of the compiler as much as the language. Play but verify, I guess.
- sklogic 10y agoSee how it is used in ROOT.
- sly010 10y agoAs an aside, I wonder if browser vendors could agree to just use something like the LLVM intermediate representation instead of javascript as a common denominator. Everyone agrees that LLVM is awesome and everyone compiles their personal favorite language to whatever browsers eat anyway.
- firethief 10y agoLike WebAssembly without sandboxing or portability to different hardware platforms?
- kr7 10y agoWebAssembly is essentially that. https://en.wikipedia.org/wiki/WebAssembly https://en.wikipedia.org/wiki/WebAssembly
- happyslobro 10y agoI suspect that sandboxing LLVM IR would not be easy. Mind you, now that browser JS runtimes grant access to GPU shaders and the ability to accept connections through webRTC, keeping JS in the sandbox isn't going to be so easy anymore.
- Mr_P 10y agoGoogle's Native Client was exactly this, but it never caught on. PNaCl is a proper subset of LLVM bytecode.
- netheril96 10y agoAny homebrew formula?
- ramgorur 10y agoVery interesting project. I am not that into clang/llvm, neither I don't have it on my machine nor know anything about clang/llvm. But a c++ interpreter is something I always wanted to use, how do I make it work for g++ 4.8.4 ?