<div class="gmail_quote">On Thu, Aug 12, 2010 at 12:25 PM, Simon Marlow <span dir="ltr">&lt;<a href="mailto:marlowsd@gmail.com">marlowsd@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div>I&#39;m not sure I want lookup (and other operations) to be inlined at every call site though.</div></blockquote><div><br>That&#39;s a good point. If inlining isn&#39;t a the right option in every case we would have to duplicate the implementation.<br>

<br>I had a look at how C++ compilers deals with this problem. They do so by duplicating the implementation in each module that instantiates the template, at least according to this document:<br><br>    <a href="http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html">http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html</a><br>

<br>As I understand it the generated code is not exported from the translation unit so there are no collisions at link time. We could do the same if we could force the generated type class instance to not be exported from the module.<br>

 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


This doesn&#39;t quite work though as two MapIntDouble defined in two<br>
different libraries are incompatible. This is essentially the same<br>
problem as with instance collisions.<br>
</blockquote><br>
<br></div>
But you get to choose the module name, so you can avoid collisions by using qualified names.<br></blockquote></div><br>Sorry, I was being unclear. The problem is that library A can&#39;t pass a MapIntDouble to library B as the types defined by the two libraries aren&#39;t compatible.<br>

<br>Cheers,<br>Johan<br><br>