<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:Arial,Helvetica,sans-serif"> think there is at least another tag that is treated specially: `f`,<br></span><span style="font-family:Arial,Helvetica,sans-serif">having to do with type families, from what I remember. </span><span style="font-family:Arial,Helvetica,sans-serif">The fact that some tags do cause special compiler behavior makes the </span><span style="font-family:Arial,Helvetica,sans-serif">situation </span>quite<span style="font-family:Arial,Helvetica,sans-serif"> tricky.</span></blockquote><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div>If you believe that the tag has significance beyond debugging etc, you may be right -- <b>but can you point to any evidence?  </b>Perhaps you can record what you learn on #26264?</div><div class="gmail_default" style=""><font face="tahoma, sans-serif"><br></font></div><div class="gmail_default" style=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:Arial,Helvetica,sans-serif"> It may seem that a plugin author should pick a<br></span><span style="font-family:Arial,Helvetica,sans-serif">tag that isn’t used by GHC. This is already difficult, because you can’t<br></span><span style="font-family:Arial,Helvetica,sans-serif">reliably tell what tags GHC uses and what tags it may use in the future.<br></span><span style="font-family:Arial,Helvetica,sans-serif">However, what if the tags of the uniques that the plugin generates<br></span><span style="font-family:Arial,Helvetica,sans-serif">*need* special treatment? For example, you may want to create uniques<br></span><span style="font-family:Arial,Helvetica,sans-serif">for local variables that your plugin introduces, and GHC may use a tag<br></span><span style="font-family:Arial,Helvetica,sans-serif">for uniques of local names that causes necessary special compiler<br></span><span style="font-family:Arial,Helvetica,sans-serif">behavior.</span></blockquote><div><br></div><div>Once again, I know of no "special compiler behaviour" but I may be wrong.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">you can’t<br>reliably tell what tags GHC uses and what tags it may use in the future.<br><span style="font-family:Arial,Helvetica,sans-serif">In the end, I used `grep` and my own eyes to check potentially the whole<br></span><span style="font-family:Arial,Helvetica,sans-serif">GHC codebase for tag use.</span></blockquote><div><br></div><div>Indeed this is bad.  Can you record the list of tags you discovered, and where they are born, in #26264?</div><div><br></div><div>Thanks!</div><div><br></div><div>Simon </div></div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, 4 Aug 2025 at 23:06, Wolfgang Jeltsch <<a href="mailto:wolfgang@well-typed.com">wolfgang@well-typed.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am Montag, dem 04.08.2025 um 16:12 +0200 schrieb Andreas Klebinger:<br>
> On 03/08/2025 17:25, Kai Prott wrote:<br>
> > According to the documentation, "the payload part of the Uniques<br>
> > allocated from this UniqSupply are guaranteed distinct wrt all other<br>
> > supplies, regardless of their 'tag'." (Assuming the unique does not<br>
> > overflow it's number of bits)<br>
> <br>
> If you read on the docs refer to an edge case in the next lines. GHC<br>
> contains a (limited) number of fixed/"built in" uniques. GHC itself<br>
> never creates uniques with the same tag as those fixed ones on the fly<br>
> so there is no risk of collision. However if you explicitly use this<br>
> tag it could happen and then compilation could go wrong. Outside of<br>
> this that is correct.<br>
<br>
I think there is at least another tag that is treated specially: `f`,<br>
having to do with type families, from what I remember.<br>
<br>
The fact that some tags do cause special compiler behavior makes the<br>
situation quite tricky. It may seem that a plugin author should pick a<br>
tag that isn’t used by GHC. This is already difficult, because you can’t<br>
reliably tell what tags GHC uses and what tags it may use in the future.<br>
However, what if the tags of the uniques that the plugin generates<br>
*need* special treatment? For example, you may want to create uniques<br>
for local variables that your plugin introduces, and GHC may use a tag<br>
for uniques of local names that causes necessary special compiler<br>
behavior.<br>
<br>
In the end, I used `grep` and my own eyes to check potentially the whole<br>
GHC codebase for tag use. My conclusion is that likely no specially<br>
treated tag is used for local variables, which are what I want the<br>
uniques for. Therefore, I probably should pick a tag that GHC surely<br>
doesn’t use and won’t ever use. I guess I’ll go for some ASCII control<br>
character.<br>
<br>
All the best,<br>
Wolfgang<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div>