If you'll search back a few months you will see that I've made pretty much the exact same complaint (although far less succinctly), for exactly the same use case (apparently Rust and Tart are similar in their approach to discriminated unions. :)<br>
<br><div class="gmail_quote">On Sun, Sep 4, 2011 at 5:26 PM, Patrick Walton <span dir="ltr"><<a href="mailto:pwalton@mozilla.com">pwalton@mozilla.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi everyone,<br>
<br>
It'd be useful for our purposes if we could attach metadata to named<br>
structs. In particular, in Rust we're looking to use this information to<br>
communicate information about our discriminated unions to the garbage<br>
collector. (We could, and are at the moment, using the metadata argument<br>
to the gcroot intrinsic, but this seems to inhibit optimizations and<br>
adds a fair amount of noise to the generated IR, so we'd like to<br>
transition to an addrspace-based GC solution at some point.)<br>
<br>
It seems to me that attaching metadata to named structs could generally<br>
be useful as a way to communicate additional ad-hoc type information to<br>
optimizers, codegen, etc., in much the same way as GCC and Clang use<br>
__attribute__ on structs.<br>
<br>
Does anyone have opinions as to whether this is a good idea?<br>
<br>
Thanks,<br>
Patrick<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>-- Talin<br>