[swift-evolution] [Completing Generics]
erik.verbruggen at me.com
Wed Mar 9 06:28:23 CST 2016
> Generic constants
> 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.,
> let π<T : FloatLiteralConvertible>: T = 3.141592653589793238462643383279502884197169399
> The Clang importer could make particularly good use of this when importing macros.
I assume the following will fall under "constant expression":
let 2π = 2 * π
Also, how does the clang-importer handle:
#define M_DOUBLE_PI (2 * M_PI)
Or rephrasing, this is specifically for the case where the initialiser only consists of a single literal token?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution