<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">I think what you proposes has a lot of merit. However I start getting twitchy when I think what this means in terms of wrapping code, potential API changes, documentation changes, etc. although maybe it has little impact. (FYI we actually did try multiple inheritance in the 1993-94 time frame when we first started implementing in C++ - a very bad experience due to the awful compilers at that time.) I think for something like this to move forward a proof of concept is required to better understand what the impact on VTK would be.</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 3, 2018 at 11:08 PM Todd Martin via vtk-developers <<a href="mailto:vtk-developers@public.kitware.com">vtk-developers@public.kitware.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px"><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px"><div><div>Hi Bill<br><div><br>I'm familiar with generics, but it doesn't address the issue here. Defining a base class with knowledge of the behaviour or attributes of its descendant classes is a violation of the Polymorphism principle.<br></div></div><div><br></div><div class="m_1749643532210456766ydp45a1a201signature"><div style="font-size:16px;font-family:Helvetica,Arial,sans-serif"><div>Todd Martin, PhD.<br></div><div><i>Freelance Engineer/Software Architect.</i></div><br></div></div></div>
<div><br></div><div><br></div>
</div><div id="m_1749643532210456766yahoo_quoted_1287410322" class="m_1749643532210456766yahoo_quoted">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
<div>
On Tuesday, July 3, 2018, 3:06:56 PM GMT+12, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="m_1749643532210456766yiv0292898568"><div><div dir="ltr">You may want to look at generic programming to solve your problem.<div><a rel="nofollow" shape="rect" href="http://www.cs.rpi.edu/~musser/gp/GPtutorial/GPtutorial-print.pdf" target="_blank">http://www.cs.rpi.edu/~musser/gp/GPtutorial/GPtutorial-print.pdf</a><br clear="none"></div></div><div class="m_1749643532210456766yiv0292898568gmail_extra"><br clear="none"><div class="m_1749643532210456766yiv0292898568gmail_quote">On Mon, Jul 2, 2018 at 4:31 PM, Todd via vtk-developers <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:vtk-developers@public.kitware.com" target="_blank">vtk-developers@public.kitware.com</a>></span> wrote:<br clear="none"><blockquote class="m_1749643532210456766yiv0292898568gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_1749643532210456766yiv0292898568yqt1721035568" id="m_1749643532210456766yiv0292898568yqt60756"><div><span class="m_1749643532210456766yiv0292898568"></span><div><br clear="none"><div class="m_1749643532210456766yiv0292898568gmail_extra"><br clear="none"><div class="m_1749643532210456766yiv0292898568gmail_quote">On 3 Jul 2018 9:07 a.m., Paul Douglas Hahn <<a rel="nofollow" shape="rect" href="mailto:pdhahn@compintensehpc.com" target="_blank">pdhahn@compintensehpc.com</a>> wrote:<br clear="none"><blockquote class="m_1749643532210456766yiv0292898568m_5047362915493203470quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
revise "base classes" -> "interface classes"<br clear="none">
<br clear="none">
<div>On 07/02/2018 04:04 PM, Paul Douglas
Hahn wrote:<br clear="none">
</div>
<blockquote>
Just one caveat (you probably already know and agree with this).
In my experience using C++ multiple inheritance, I think you
should try to avoid situations where you have common base classes
in the inheritance pathways. Virtual base classes are the usual
recommendation to resolve certain problems that arise in such
cases, but IMHO having experience with that, I generally recommend
against it.<br clear="none">
<br clear="none">
So I recommend your base classes should be of the "<u>mix-in</u>"
interface category, not relaying on any common base class. The
approach works fine for me in almost every situation.<br clear="none">
</blockquote></div></blockquote></div></div></div><div><br clear="none"></div><div>Thanks Paul. That sounds exactly like what I have done with the vtkCellWithEdges and vtkCellWithFaces classes introduced in the aforementioned merge request.</div><span class="m_1749643532210456766yiv0292898568"></span><div><div class="m_1749643532210456766yiv0292898568gmail_extra"><div class="m_1749643532210456766yiv0292898568gmail_quote"><blockquote class="m_1749643532210456766yiv0292898568m_5047362915493203470quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><blockquote><br clear="none">
- Paul<br clear="none">
<br clear="none">
<div>On 07/02/2018 12:44 AM, Todd Martin
via vtk-developers wrote:<br clear="none">
</div>
<blockquote>
<div style="font-family:'helvetica neue','helvetica','arial',sans-serif;font-size:16px">
<div style="font-family:'helvetica neue','helvetica','arial',sans-serif;font-size:16px">
<div>
<div>Single inheritance languages like Java and C# utilize
<i>interfaces</i> extensively. Python 2.7+ handles the
same concept with abstract base classes, ABCs.<br clear="none">
<div><br clear="none">
<div>
<div>
<div>Is there any interest in supporting<i>
interfaces</i> in VTK via multiple inheritance
from abstract classes (which do not inherit from
vtkObject) while retaining the single
inheritance model?<br clear="none">
<div><br clear="none">
In my view there are good reasons to do so.
For example vtkCell has methods like
GetNumberOfEdges(), GetEdge(),
GetNumberOfFaces(), GetFace() etc. which
really only apply to multi-dimensional cells
(both linear and non-linear); i.e. not points
and lines. These methods are forced on the
base class design by a single inheritance
structure and the linear/non-linear cell
sub-types. In my view it would be better if
they were distributed across the sub-classes
via the concept of interfaces. So I'm
suggesting a limited use of multiple
inheritance here, not a free-for-all approach.
What do others think about this?<br clear="none">
<div>
<div>
<div>
<div><br clear="none">
</div>
For an example please see this merge
request <a rel="nofollow" shape="rect" href="https://gitlab.kitware.com/vtk/vtk/merge_requests/4372" target="_blank">Add missing
size hints and bug fix point arrays
for non-linear cells (!4372) · Merge
Requests · VTK / VTK</a></div>
</div>
</div>
</div>
</div>
</div>
<div><br clear="none">
</div>
<div style="max-width:400px;font-family:'neue' 'segoe ui arial',sans-serif"><a rel="nofollow" shape="rect" href="https://gitlab.kitware.com/vtk/vtk/merge_requests/4372" style="text-decoration:none!important;color:#000!important" target="_blank">
<table style="max-width:400px" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" width="400">
<table style="max-width:400px;border-width:1px;border-style:solid;border-color:rgb(224,228,233);border-radius:2px" width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" style="background-color:rgb(0,0,0);background-repeat:no-repeat;border-radius:2px 2px 0px 0px;min-height:175px" valign="top" height="175" bgcolor="#000000">
<table style="width:100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" style="background-color:transparent;border-radius:2px 2px 0px 0px;min-height:175px" valign="top" bgcolor="transparent">
<table style="width:100%;min-height:175px" border="0"><tbody><tr><td colspan="1" rowspan="1" style="text-align:left;padding:15px 0 0 15px;vertical-align:top"><br clear="none">
</td><td colspan="1" rowspan="1" style="text-align:right;padding:15px 15px 0 0;vertical-align:top"><br clear="none">
</td></tr></tbody></table>
</td></tr></tbody></table>
</td></tr><tr><td colspan="1" rowspan="1">
<table style="background-color:rgb(255,255,255);background-image:none;background-repeat:repeat;width:100%;max-width:400px;border-radius:0px 0px 2px 2px;border-top:1px solid rgb(224,228,233)" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td colspan="1" rowspan="1" style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;border-radius:0 0 0 2px"><br clear="none">
</td><td colspan="1" rowspan="1" style="vertical-align:middle;padding:12px 24px 16px 12px;width:99%;font-family:'neue' 'segoe ui arial',sans-serif;border-radius:0 0 2px 0">
<h2 style="font-size:14px;line-height:19px;margin:0 0 6px 0;font-family:'neue' 'segoe ui','helvetica','arial',sans-serif;color:#26282a">Add
missing size hints and
bug fix point arrays
for non-linear cells
(!4...</h2>
<p style="font-size:12px;line-height:16px;margin:0px;color:#979ba7">I've
added size hints for
concrete public
methods
GetParametricCoords(),
GetEdgePoints() and
GetFacePoints() in ...</p>
</td></tr></tbody></table>
</td></tr></tbody></table>
</td></tr></tbody></table>
</a></div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
</div>
</div>
</div>
<div><br clear="none">
</div>
<div>
<div style="font-size:16px;font-family:'helvetica','arial',sans-serif">
<div>Todd Martin, PhD.<br clear="none">
</div>
<div><i>Freelance Engineer/Software Architect.</i></div>
<br clear="none">
</div>
</div>
</div>
</div>
</div>
<br clear="none">
<fieldset></fieldset>
<br clear="none">
<pre>______________________________ _________________
Powered by <a rel="nofollow" shape="rect" href="http://www.kitware.com" target="_blank">www.kitware.com</a>
Visit other Kitware open-source projects at <a rel="nofollow" shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/ opensource/opensource.html</a>
Search the list archives at: <a rel="nofollow" shape="rect" href="http://markmail.org/search/?q=vtk-developers" target="_blank">http://markmail.org/search/?q= vtk-developers</a>
Follow this link to subscribe/unsubscribe:
<a rel="nofollow" shape="rect" href="https://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">https://public.kitware.com/ mailman/listinfo/vtk- developers</a>
</pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre>--
Paul D. Hahn
CompIntense HPC, LLC
</pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre>--
Paul D. Hahn
CompIntense HPC, LLC
</pre>
</div>
</blockquote></div><br clear="none"></div></div></div></div><br clear="none">______________________________ _________________<br clear="none">
Powered by <a rel="nofollow" shape="rect" href="http://www.kitware.com" target="_blank">www.kitware.com</a><br clear="none">
<br clear="none">
Visit other Kitware open-source projects at <a rel="nofollow" shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/ opensource/opensource.html</a><br clear="none">
<br clear="none">
Search the list archives at: <a rel="nofollow" shape="rect" href="http://markmail.org/search/?q=vtk-developers" target="_blank">http://markmail.org/search/?q= vtk-developers</a><br clear="none">
<br clear="none">
Follow this link to subscribe/unsubscribe:<br clear="none">
<a rel="nofollow" shape="rect" href="https://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">https://public.kitware.com/ mailman/listinfo/vtk- developers</a><br clear="none">
<br clear="none">
<br clear="none"></blockquote></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div class="m_1749643532210456766yiv0292898568gmail_signature">Unpaid intern in BillsParadise at noware dot com</div>
</div></div></div></div>
</div>
</div></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>William J. Schroeder, PhD<br>Kitware, Inc. - Building the World's Technical Computing Software<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br><a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>(518) 881-4902</div></div></div>