<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><blockquote type="cite" class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">My issue with C++ is not the language itself, but the lack of discipline of C++ developers. There are disastrous stories we all know well. But there are successful ones, like VTK/ParaView.</div></div></div></blockquote><div class=""><br class=""></div> I fear that it would be difficult to learn and maintain discipline in PETSc C++ developments. We are largely self-taught, want functionality quickly, and the google approach to learning C++ and implementing PETSc will be a disaster. We would need to have a starting mechanism that prevents the monkeys with machine guns.<div class=""><br class=""></div><div class=""> To do multiple language mappings properly, I think we need to start with a language with a powerful, high-level useful AST (or some similar representation) that automated tools can scarf through to generate language bindings and verify the code is properly written from day one. Rather than picking the language based on its syntax, flexibility etc, we should pick it based on this property. Does clang work with a high enough level of abstraction in its representation of C++ to map directly to Python classes, for example. Does Python have any useful high-level representation that could be used so that we write in Python and generate from its representation? Rust? Zig? Carbon? Fortran 2035?</div><div class=""><br class=""></div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 31, 2022, at 10:26 AM, Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com" class="">dalcinl@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 31 Jul 2022 at 17:07, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class="">On Sun, Jul 31, 2022 at 9:06 AM Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com" target="_blank" class="">dalcinl@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div dir="ltr" class="">On Sun, 31 Jul 2022 at 16:41, Jacob Faibussowitsch <<a href="mailto:jacob.fai@gmail.com" target="_blank" class="">jacob.fai@gmail.com</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="">
> Please don't take my words as advocacy for C++<br class="">
<br class="">
I’m going to pretend like I didn’t read this :)<br class=""></blockquote><div class=""><br class=""></div><div class="">Whatever the final decision is, PETSc should keep providing a plain C API. C is lingua franca, C++ is not. Many other programming languages have runtime FFIs mostly based on the C ABI guarantees (Java, Python, MATLAB, Rust, Julia, etc). C++ may be great for development, but I do not consider it great for crossing language boundaries. </div><div class=""><br class=""></div><div class="">Maybe the right approach for petsc4py is to first get nice and modern C++ bindings implemented by wrapping the C interface. And then map these C++ bindings to Python.</div></div></div></blockquote><div class=""><br class=""></div><div class="">My crystal ball says that such a C++ binding would eventually be thrown away just as in the case of MPI.</div></div></div></blockquote><div class=""><br class=""></div><div class="">MPI C++ failed because it provided little added value. But if a PETSc C++ API would become the base of bindings for other OO languages, then there is value in maintaining these C++ bindings.</div><div class="">Furthermore, these C++ bindings could serve as the foundation for a reimplementation of PETSc in C++, if that ever happens. And that can be done gradually.</div><div class=""><br class=""></div><div class="">PS: Modern C++ is a great language to implement stuff. People using C++ is another story, it is like giving a machine gun to monkeys. Well, at this point, I could say exactly the same about Python. </div><div class="">My issue with C++ is not the language itself, but the lack of discipline of C++ developers. There are disastrous stories we all know well. But there are successful ones, like VTK/ParaView.</div></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class="">Lisandro Dalcin<br class="">============<br class="">Senior Research Scientist<br class="">Extreme Computing Research Center (ECRC)<br class="">King Abdullah University of Science and Technology (KAUST)<br class=""><a href="http://ecrc.kaust.edu.sa/" target="_blank" class="">http://ecrc.kaust.edu.sa/</a><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>