<div dir="ltr">On Wed, Jun 19, 2013 at 1:04 AM, edA-qa mort-ora-y <span dir="ltr"><<a href="mailto:eda-qa@disemia.com" target="_blank">eda-qa@disemia.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<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">In my language I have anonymous types (essentially tuples), and I have<br>

generated functions (like constructors) which are unique for these<br>
types. If the same type occurs in multiple modules however it should end<br>
up with only one definition being linked. Thus I need a way to give them<br>
the same name.<br>
<br>
The problem is that if I derive the name from what the type contains the<br>
length of that name is essential unbound. So how does one generate<br>
names?  I'm thinking of just using a long hash and hoping I don't get<br>
accidental collisions. Surely there must be a better way?<br>
<br>
<br>
Currently, since I'm only dealing with one module, it is very easy to<br>
just assign unique numbers. But obviously this doesn't work with<br>
multiple independent modules since they'd all need the same name. It<br>
will ultimately have to work across libraries as well, so I can't just<br>
create a registry of the type->id.<br><br></blockquote><div><br></div><div>I think you've covered all the possible implementations.</div><div><br></div><div>In terms of just generating long names, LLVM and common platforms can handle long names reasonably well because C++ often uses such names.  Also, the Itanium C++ ABI has a scheme to compress repeated uses of the same type which might be of interest; see <a href="http://mentorembedded.github.io/cxx-abi/abi.html#mangling-compression">http://mentorembedded.github.io/cxx-abi/abi.html#mangling-compression</a> .</div>
<div><br></div><div>In terms of a registry, you might want to consider whether these helpers actually need to be exposed across libraries.</div><div><br></div><div>-Eli </div></div><br></div></div>