Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is not a definite answer, but I thought I might post it anyway since it might be useful to some people.</p> <p>Commenter <a href="https://stackoverflow.com/users/303726/julio-guerra" title="Julio Guerra&#39;s profile">Julio Guerra</a> pointed out a C++ idiom (they call it a "paradigm" in the papers, but I think that's a bit too much) called <em>Static C++ Object-Oriented Programming</em> (SCOOP). I'll be posting this to give SCOOP more visibility.</p> <p>SCOOP was invented to allow C++ programmers to get the best of both the OOP and the GP worlds by making both play well together in C++. It aims primarily at scientific programming because of the performance gain it can bring and because it can be used to increase code expressivity.</p> <p>SCOOP makes C++ generic types emulate seemingly all aspects of traditional object-oriented programming — statically. This means template methods get to feature, for example, the ability to be properly overloaded and (apparently) issue much more proper error messages than those usually caused by your casual template function.</p> <p>It can also be used to do some funny tricks such as conditional inheritance.</p> <p>What I was trying to accomplish with <code>static_ptr&lt;&gt;</code> was precisely a type of static object-orientation. SCOOP moves that to a whole new level.</p> <p>For those interested, I've found two papers talking about this: <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.2.8789&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer" title="A Static C++ Object-Oriented Programming (SCOOP) Paradigm Mixing Benefits of Traditional OOP and Generic Programming">A Static C++ Object-Oriented Programming (SCOOP) Paradigm Mixing Benefits of Traditional OOP and Generic Programming</a> and <a href="http://homepages.fh-regensburg.de/~mpool/mpool08/submissions/Levillain.pdf" rel="nofollow noreferrer" title="Semantics-Driven Genericity: A Sequel to the Static C++ Object-Oriented Programming Paradigm (SCOOP 2)">Semantics-Driven Genericity: A Sequel to the Static C++ Object-Oriented Programming Paradigm (SCOOP 2)</a>.</p> <p>This idiom is not without its own faults, though: it's one of those uncommon things that should be your last resort since people will most likely have a tough time figuring what you did, etc. Your code will also get more verbose and you're likely to find yourself unable to do things you thought would be possible.</p> <p>I'm sure it's still useful under some circumstances, though, not to mention <em>real fun</em>.</p> <p>Happy template hacking.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload