Re:Online LLVM-based C++ REPL
by mynegation on Friday August 19, 2016 @10:35AM
(#12320269)
It is a great idea in general and a technical feat in itself. It is just that C++ is not the best language for that type of programming. It may work OK for toy to lower-middle size of projects, but for big projects compilation time starts to pile up pretty quickly. One reason for that is C legacy of header files that are recompiled for each and every translation unit (yes there are PCH but they are unwieldy and require a lot of babysitting and sometimes take back almost all of the time you gain from their usage). Another is C++ language grammar: C++ requires 3 (three!) syntax passes to be parsed correctly. Then there is also all the template and metaprogramming magic which is Turing complete (Just look at Facebook Fatal C++ library - I am still undecided if they are for real or it is an elaborate trolling).
Re:Online LLVM-based C++ REPL
by naveen99 on Friday August 19, 2016 @10:57AM
(#12320443)
but isn't that the point ? If recompiling takes a long time, you don't want to recompile, if all you want to do is add a few function calls to explore an api or inspect state.
cern uses a c interpreter for real. This is just bringing it to a wider audience with a friendlier interface.
Re:Online LLVM-based C++ REPL
by roel_v on Friday August 19, 2016 @02:59PM
(#12322575)
Yes, C++ takes long to compile compared to other languages. But I never understood the problems people have with precompiled headers. They've worked just fine, without any tweaking or babysetting, for me since Visual Studio 6. That's 15+ years. I don't know how/if the implementations of gcc or clang work, but using the msvc compiler precompiled headers are braindead simple.
Re:Online LLVM-based C++ REPL
by DannyBee on Friday August 19, 2016 @03:28PM
(#12322808)
"I ignored it on purpose, because it never evolved beyond a proof of concept."
This is false, it is used in production at Google for over 200+ million lines of C++. In fact, it's the only modules implementation actually used in production, AFAIK.
"It only got production quality for Objective-C and Swift interoperability."
Also false :)
"Also it relied on an external description files, instead of extending C++."
Which means what, precisely?
This is a means to compatibility, nothing else.
The other proposal basically breaks everything to make modules work (IE a non-modules compiler cannot work with the code once converted to modules). That may or may not be worth the cost compared to enabling incremental transitions.
Saying "it didn't extend C++" is a non-sequitur. What the standard accepts are extensions of C++. If the standard accepts that proposal, it's an extension of C++.
You could say using header files were "external description files" that didn't extend C++ before they were part of the standard.
Re:Online LLVM-based C++ REPL
by pjmlp on Friday August 19, 2016 @03:58PM
(#12323019)
> This is false, it is used in production at Google for over 200+ million lines of C++. In fact, it's the only modules implementation actually used in production, AFAIK.
Not all of us get to see what goes inside Google.
The only LLVM talk about modules was several years ago (2012) and then Doug went silent on his work. I never saw a single post on the ISO C++ mailing lists about modules and their progress.
> "It only got production quality for Objective-C and Swift interoperability."
>
> Also false :)
When I got to develop on Mac OS X system, it only worked properly with Objective-C code and for the system headers.
As far as I am aware you still can't use them with C++ on Sierra, at least there wasn't a single mention of it at WWDC on the LLVM and clang improvements talk.
I don't want to rely on external files to declare how #include should behave, I want to you module/import/export keywords and such.
Also I am on the side of those that don't want macros to escape modules.
Re:Online LLVM-based C++ REPL
by tptacek on Saturday August 20, 2016 @11:06AM
(#12326907)
You wrote "I ignored it on purpose, because it never evolved beyond a proof of concept." I don't think "Not all of us get to see what goes inside Google" is a very good response to learning that you were wrong to the tune of 200+ million lines of code inside Google.
I don't care that much, right, but sometimes you see message board nerd bloody-mindedness to breathtaking degrees and you have to say something or the fluid in your eyeballs starts boiling.
This is small, probably supports most things.
This can be used to show small hacks about programming(c++ has many of them) and share with others. The developer can experiment in the browser.
cern uses a c interpreter for real. This is just bringing it to a wider audience with a friendlier interface.
i wonder if it works with cuda... http://llvm.org/docs/CompileCudaWithLLVM.html
It only got production quality for Objective-C and Swift interoperability.
Also it relied on an external description files, instead of extending C++.
This is false, it is used in production at Google for over 200+ million lines of C++. In fact, it's the only modules implementation actually used in production, AFAIK.
"It only got production quality for Objective-C and Swift interoperability."
Also false :)
"Also it relied on an external description files, instead of extending C++." Which means what, precisely? This is a means to compatibility, nothing else.
The other proposal basically breaks everything to make modules work (IE a non-modules compiler cannot work with the code once converted to modules). That may or may not be worth the cost compared to enabling incremental transitions.
Saying "it didn't extend C++" is a non-sequitur. What the standard accepts are extensions of C++. If the standard accepts that proposal, it's an extension of C++.
You could say using header files were "external description files" that didn't extend C++ before they were part of the standard.
Not all of us get to see what goes inside Google.
The only LLVM talk about modules was several years ago (2012) and then Doug went silent on his work. I never saw a single post on the ISO C++ mailing lists about modules and their progress.
> "It only got production quality for Objective-C and Swift interoperability." > > Also false :)
When I got to develop on Mac OS X system, it only worked properly with Objective-C code and for the system headers.
As far as I am aware you still can't use them with C++ on Sierra, at least there wasn't a single mention of it at WWDC on the LLVM and clang improvements talk.
I don't want to rely on external files to declare how #include should behave, I want to you module/import/export keywords and such.
Also I am on the side of those that don't want macros to escape modules.
I don't care that much, right, but sometimes you see message board nerd bloody-mindedness to breathtaking degrees and you have to say something or the fluid in your eyeballs starts boiling.
As it happened the only truth that we in the outside world were made aware of, was what Apple was doing regarding Objective-C support.
So yeah I was wrong, but maybe clang guys should blog as much as VC++ about what is happening.
Another example is the ongoing support of the core guidelines.
I do follow all presentations from LLVM meetings, can you give me a link to any that I missed regarding modules post 2012?
I played around with it a little.
It doesn't crash on errors, just prints a helful error message.
Time for one more attempt at teaching my son programming, with c++ this time !
previous discussion with more info: https://news.ycombinator.com/item?id=11478301
http://fiddle.jyt.io/github/9a340a40988f79264c3686a90d2d80e3
Would be nice to be able to opt out of that.