<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><i style="font-size: 14px;" class="">Generic constants</i></div><div class=""><br class=""></div><div class="">let constants could be allowed to have generic parameters, such that they produce differently-typed values depending on how they are used. For example, this is particularly useful for named literal values, e.g.,</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><font face="Menlo" class="">let π<T : FloatLiteralConvertible>: T = 3.141592653589793238462643383279502884197169399</font></div></blockquote><div class=""><br class=""></div><div class="">The Clang importer could make particularly good use of this when importing macros.</div></div></div></blockquote><br class=""></div><div>I assume the following will fall under "constant expression":</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>let 2π = 2 * π</div><div><br class=""></div><div>Also, how does the clang-importer handle:</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>#define M_DOUBLE_PI (2 * M_PI)</div><div><br class=""></div><div>Or rephrasing, this is specifically for the case where the initialiser only consists of a single literal token?</div><div><br class=""></div><div>-- Erik.</div></body></html>