<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">HI Teemu!<div><br></div><div>Email is always a bit dangerous/difficult when it comes to tone - sorry if it had too few smileys late a friday night ;-)&nbsp;</div><div><br></div><div>My point wasn’t at all to critize the current C++ code, but to emphasize that we’ve been fine with introducing more C++ features than we originally planned, before saying that there are still some things at least I want us to wait with. You are probably right that the multiple templates are only in testing code - and I frequently have memory like a goldfish. Had I actually been troubled by a specific piece of code, you can trust that I would have complained on redmine.</div><div><br></div><div>I don’t think the balance in our C/C++ transition is primarily a technical one (I’m sure C++ is fine technically for at _least_ 99.999%), but more social. We need to strike a balance between introducing enough C++ to make life easy and productive for C++ wizards, while limiting it enough so we don’t cause too much frustration and dropped productivity for non-C++-wizards (hey, that largely includes me :-). I think this means the balance will naturally move much more towards C++ as we go on, but we’ll need to let that take some time!</div><div><br></div><div>Then the performance-sensitive routines are separate chapter. Post-5.0 I think we need come up with a better policy on what that really is, and try to limit it severely. Right now we have far too much hardware-specific code that is even more difficult to read than C++ (e.g. SIMD), and finding ways to reduce this will give us more time to spend on the higher-level code - in particular C++ !</div><div><br></div><div>Cheers,</div><div><br></div><div>Erik</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div><div>On 11 Jan 2014, at 06:47, Teemu Murtola &lt;<a href="mailto:teemu.murtola@gmail.com">teemu.murtola@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">

<div>
<div dir="ltr">Hello,<br>
<div class="gmail_extra"><br>
</div>
<div class="gmail_extra">I do understand your point about testing the C++ support before we use it everywhere, and I don't disagree with that, but your tone just prompts for a response for some of the details. ;)<br>
<br>
<div class="gmail_quote">On Fri, Jan 10, 2014 at 11:47 PM, Erik Lindahl <span dir="ltr">
&lt;<a href="mailto:erik.lindahl@scilifelab.se" target="_blank">erik.lindahl@scilifelab.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div>Yes. Remember that after a lot of deliberation we agreed on a compromise to allow _very_ limited amounts of C++. This ended up being pushed to accept a lot more C++ (including Boost, exceptions, etc.).</div>
</div>
</blockquote>
<div><br>
</div>
<div>Of course it depends on how you view it (and how you define "amounts"; see below my comment on "heavy C++"), but vast majority of the C++ code is currently "simple", in the sense that it only uses very basic C++ constructs (classes, yes, and some inheritance,
 and occasional simple template).</div>
<div><br>
</div>
<div>I remember the discussion on exceptions, and in the end everyone seemed to agree that this would be the way to go.</div>
<div><br>
</div>
<div>We _still_ don't require anything major from boost except for the boost::exception support that we originally decided on (and the dependencies it already brings with it, which is basically boost::shared_ptr); the only thing added after that is boost::scoped_ptr,
 and I have hard time believing that would be a bottleneck for anything. By necessity, the use of exceptions requires some usage of smart pointers throughout the code, but even this is fairly limited.</div>
<div>&nbsp;</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div>The decision we made about only allowing single templates also appear to have been broken rapidly...</div>
</div>
</blockquote>
<div><br>
</div>
<div>Could you perhaps elaborate? There is a _single_ instance of a template with multiple parameters in the code (outside test code). That particular template has been there from the start, and I remember in 2010 explicitly showing _you_ the code and _specifically_
 asking whether this part was too complex. And you said no. The test code can always be disabled, and doesn't affect the ability to compile mdrun or its performance.</div>
<div><br>
</div>
<div>Most other uses of templates are in specifying the contained type for a container-like class, in very simple classes, or in individual methods where they reduce the amount of boilerplate code the caller needs to use, hopefully reducing the potential for
 bugs. There is no partial specialization, there shouldn't be templated overloads with non-trivial resolution rules, no SFINAE, no type traits, etc. If you mean something else, please clarify.&nbsp;</div>
<div><br>
</div>
<div>If you want to restrict passing templated types as template parameters to other classes, then note that also, e.g., std::vector has multiple template parameters, and the allocator itself (the second parameter, which has a default value) is a template.</div>
<div>&nbsp;</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div>Remember that most developers are not professional C++ programmers, and I’m a bit worried that large parts of the code are turning into pretty heavy C++.</div>
</div>
</blockquote>
<div><br>
</div>
<div>Again, this depends on your definition of "heavy". If you define it as "over 10% of this source file would not compile with a C compiler", then yes, but is that really the definition you want? As said above, vast majority of the code only uses very basic
 C++ constructs, and I would not call that "heavy", even though it is 100% C++, and not C. And nearly all of the C++ code is documented, at least on some level, which hopefully lowers the barrier. I'm willing to (and I hope other people would be, too) to improve
 the documentation, but that would be more efficient if others would actually specify what parts they would like to have improved.</div>
<div><br>
</div>
<div>My impression is that very few are really interested in (or maybe rather, does not have the time to) actually discuss any details related to C++, on the level that would lead to some concrete results. In such an environment, if we had just waited to have
 a common agreement on every single detail, with everyone explicitly voicing that agreement, we (I) would probably not have written a single line of code in the past 2-3 years… Maybe that would have been best for my sanity, but it's hard to say where we would
 be if that were the case. Since Gerrit came to use, I have simply pushed up small incremental work, not trying to introduce any additional C++ features without a very good reason (and those have been very few, and most have been discussed at least in Redmine).
 I've yet to see a specific, concrete complaint on where people would like to have "simpler" C++ or "less heavy" C++.</div>
<div><br>
</div>
<div>Just some (or maybe quite a few) thoughts,</div>
<div>Teemu</div>
</div>
</div>
</div>
</div>

-- <br>Gromacs Developers mailing list<br><br>* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br><br>* Can't post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists">http://www.gromacs.org/Support/Mailing_Lists</a><br><br>* For (un)subscribe requests visit<br><a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.</blockquote></div><br></div></body></html>